Ravindra BagaleCourses & study guides मराठी Track your progress

What Is Amazon SageMaker? Machine Learning on AWS Explained

SageMaker is the big ML workshop on AWS: notebooks to explore, training jobs to learn from data, endpoints to serve predictions. Powerful — and easy to leave a meter running. Read the cost box twice.

What you'll learn in this chapter

  • What SageMaker is for
  • Notebooks vs training vs endpoints
  • Built-in algorithms vs your container
  • SageMaker vs Bedrock
  • Cost and sandbox warnings

1. Everyday example

Why do we need this?

A bank wants to score loan risk from past rows. Data scientists need a notebook, a training run on bigger machines, then an API that returns a score in milliseconds.

What is it?

Amazon SageMaker is a managed set of services to build, train and deploy machine learning models on AWS without you assembling raw GPU clusters by hand.

Typical pathS3 datatraining setNotebookexplore & codeTraining jobfits the modelModel artifactin S3Endpointreal-time predict
Batch transform exists when you do not need a 24×7 endpoint.

2. Main pieces

PieceDoesBill watch
SageMaker Studio / Notebook instancesInteractive Python/R explorationInstance runs until you stop/delete
Training jobFits model on chosen instance typePays while the job runs
EndpointHosted HTTPS model for live trafficPays while InService — easy to forget
Processing / Batch transformOffline feature jobs / bulk scoresPays for the job duration

3. SageMaker vs Bedrock

  • SageMaker: you (or your team) train/customize models on your data; classic ML + many DL workflows.
  • Bedrock: call ready foundation models via API (chat, embeddings) — no GPU training required for the base model.
  • Many apps use both: Bedrock for text generation, SageMaker for a custom fraud model.

Cost & sandbox

Never leave notebook instances or endpoints running overnight in a student account. Prefer Studio with auto-shutdown where available. Delete endpoints after demos. Training on large GPU instances can cost a lot in one afternoon — start with tiny sample data and small instance types.

4. Interview angles

Q. Three pillars?

Build (notebooks), train (jobs), deploy (endpoints).

Q. Where do artifacts live?

Usually S3 model.tar.gz style outputs.

Q. Why not EC2 DIY?

SageMaker handles images, metrics, scaling patterns.

Q. Real-time vs batch?

Endpoint vs batch transform.

Q. Bedrock instead?

When a managed foundation model API is enough.

Try at home

  1. Open SageMaker console in ap-south-1 and list instance prices — do not create yet.
  2. Write one sentence: your project needs SageMaker or Bedrock?

In short

  1. SageMaker = build, train, deploy ML on AWS.
  2. Endpoints and notebooks bill while running.
  3. Bedrock is the better fit for many generative API apps.
  4. Delete lab resources the same day.

Practice Tasks

About this scenario

Tokyo Ramen House is a restaurant business in Tokyo. Yuki Tanaka looks after its IT and cloud work. They count money in JPY and run their AWS resources in the ap-northeast-1 Region. In the tasks below you do real jobs for them using what this lesson teaches. All names, account IDs, IP addresses and numbers are made up for practice.

0 / 10

Easy List SageMaker endpoints

Why: Endpoints cost money every hour; list them to find forgotten ones.

What to do: List SageMaker endpoints.

How:
  1. Read the task and decide which AWS service it is about.
  2. Write aws, then the service name, then the operation (the action word).
  3. Add each needed flag (--name) followed by its value from the task.
  4. Flags can be in any order. Click Check answer.

Easy List Bedrock models

Why: See which foundation models are offered in your Region.

What to do: List the foundation models available in Amazon Bedrock.

How:
  1. Read the task and decide which AWS service it is about.
  2. Write aws, then the service name, then the operation (the action word).
  3. Add each needed flag (--name) followed by its value from the task.
  4. Flags can be in any order. Click Check answer.

Easy How many addresses in a /16?

Why: Picking a VPC size needs this count.

What to do: Tokyo Ramen House plans the VPC 10.27.0.0/16. How many IP addresses does it hold in total?

How:
  1. Write down the numbers the task gives you.
  2. Work it out step by step on paper.
  3. Type only the final answer in the box.
  4. Click Check answer.

Easy Port for SSH

Why: Security group rules need the right port.

What to do: Which TCP port must the security group open for SSH?

How:
  1. Write down the numbers the task gives you.
  2. Work it out step by step on paper.
  3. Type only the final answer in the box.
  4. Click Check answer.

Easy Show where you are

Why: Before you copy or delete anything, you must know which folder you are in.

What to do: Yuki Tanaka logged in to the Tokyo Ramen House server and is not sure which folder the terminal is in. Print the current folder path.

How:
  1. Find the Linux command that does this job.
  2. Add the options (like -r or -h) the task needs.
  3. Add the file names, folders or users in the right order.
  4. Use sudo if the job changes system files or users. Click Check answer.

Medium Allow one Bedrock model

Why: Limit apps to the approved model so costs stay predictable.

What to do: Allow bedrock:InvokeModel on arn:aws:bedrock:ap-northeast-1::foundation-model/amazon.nova-lite-v1:0 only.

How:
  1. Start with { "Version": "2012-10-17", "Statement": [ ... ] }.
  2. In each statement write Effect, Action and Resource.
  3. Give only what the task needs (least privilege).
  4. Use double quotes and commas correctly. Click Check answer.

Medium Detect labels in an image

Why: Rekognition names objects in a photo, e.g. to tag product images.

What to do: Detect labels in s3://tokyoramen-media/shop/p1.jpg (Bucket=tokyoramen-media, Name=shop/p1.jpg), max 10 labels.

How:
  1. Read the task and decide which AWS service it is about.
  2. Write aws, then the service name, then the operation (the action word).
  3. Add each needed flag (--name) followed by its value from the task.
  4. Flags can be in any order. Click Check answer.

Medium Delete an unused endpoint

Why: Deleting a test endpoint stops the hourly bill.

What to do: Delete endpoint tokyoramen-demand-forecast.

How:
  1. Read the task and decide which AWS service it is about.
  2. Write aws, then the service name, then the operation (the action word).
  3. Add each needed flag (--name) followed by its value from the task.
  4. Flags can be in any order. Click Check answer.

Hard Ask a model a question

Why: Converse is one API shape for many models.

What to do: Call converse on model amazon.nova-lite-v1:0 with the messages in msgs.json.

How:
  1. Read the task and decide which AWS service it is about.
  2. Write aws, then the service name, then the operation (the action word).
  3. Add each needed flag (--name) followed by its value from the task.
  4. Flags can be in any order. Click Check answer.

Hard Call a model endpoint

Why: Your app sends features to the endpoint and gets a prediction back.

What to do: Invoke endpoint tokyoramen-demand-forecast with body from input.csv, content type text/csv, saving the result to out.json.

How:
  1. Read the task and decide which AWS service it is about.
  2. Write aws, then the service name, then the operation (the action word).
  3. Add each needed flag (--name) followed by its value from the task.
  4. Flags can be in any order. Click Check answer.

Revision, comparison and interview cards

Revise this lesson in a few minutes. Save the cards on your phone or download them as PNG files. The QR code on each card opens this lesson.

Revision card: What is Amazon SageMaker?. Banks and apps need notebooks, training on bigger machines, then a fast score API — without hand-building GPU clusters. Amazon SageMaker is a managed toolkit to build, train and deploy machine learning models on AWS. Explore in Studio/notebooks → run a training job → deploy an endpoint or use batch transform. A training job writes model.tar.gz style artifacts to S3; an endpoint serves HTTPS predictions.
Revision card: What is Amazon SageMaker? · Download PNG · Open card page
Revision card: SageMaker bill traps. Notebooks and endpoints bill while InService — easy to forget overnight. Stop or delete notebook instances and endpoints after demos. Start with tiny data and small instance types. Before any lab: set a budget alert; prefer auto-shutdown; never leave ml.g* GPUs running “just in case”. Cost Explorer shows endpoint hours drop to zero after delete; no surprise morning bill.
Revision card: SageMaker bill traps · Download PNG · Open card page
Revision card: SageMaker vs Bedrock. Teams ask for “AI on AWS” without knowing if they train or just call a model. SageMaker: you train/customize on your labelled data. Bedrock: call managed foundation models via API without training the base model. Fraud score on your rows → SageMaker. Chat/summarise with Claude/Llama-class models → Bedrock. Many apps use both: Bedrock for text, SageMaker for a custom classifier.
Revision card: SageMaker vs Bedrock · Download PNG · Open card page
Comparison: Amazon SageMaker vs Amazon Bedrock. Amazon SageMaker: You build/train/deploy models on your data. Amazon Bedrock: Call managed foundation models via API.
Comparison: Amazon SageMaker vs Amazon Bedrock · Download PNG · Open card page
Comparison: SageMaker real-time endpoint vs SageMaker batch transform. SageMaker real-time endpoint: Bills while the endpoint stays InService. SageMaker batch transform: Pays for the transform job duration only.
Comparison: SageMaker real-time endpoint vs SageMaker batch transform · Download PNG · Open card page
Interview card: Three pillars of SageMaker?. Build (notebooks/Studio), train (training jobs), deploy (endpoints or batch). Interviewers expect this map before feature-name soup. Notebook explore → Training job → Endpoint InService (then delete after demo).
Interview card: Three pillars of SageMaker? · Download PNG · Open card page
Interview card: Real-time endpoint vs batch transform?. Endpoint = always-on HTTPS model for live traffic (bills while InService). Batch transform = score a dataset offline and stop paying when the job ends. Chatty API scores → endpoint; nightly score 1M rows → batch transform.
Interview card: Real-time endpoint vs batch transform? · Download PNG · Open card page

More cards: Ravi Sir's Cards.