Skip to content
advanced Phase 13 · AWS Machine Learning

SageMaker Basics

Train and deploy ML models with Amazon SageMaker.

1h 15m
0 problems
Topic Progress 0%

The ML Lifecycle in SageMaker

The ML Lifecycle in SageMaker

SageMaker wraps the loop every ML team repeats: prepare data, train, evaluate, deploy, monitor. Data lands in S3; processing jobs clean and split it; training runs on managed instances using built-in algorithms or your own script; experiments track metrics and hyperparameters; the model registry versions artifacts; endpoints serve traffic; Model Monitor watches for drift.

The value over renting EC2 is managed plumbing: no AMI patching, job status and CloudWatch logs in one place, and repeatable pipelines so a retrain is a parameter change rather than a tribal runbook. SageMaker Studio provides the notebook/IDE surface over all of it.

Train and Deploy

Train and Deploy

A training job declares the container, hyperparameters, instance type/count, and an output path in S3. The Python SDK reduces this to an estimator:

estimator.fit(inputs={"train": "s3://bucket/train/"})
predictor = estimator.deploy(
    initial_instance_count=1,
    instance_type="ml.m5.large",
)

deploy creates an endpoint configuration and invokes with a serialized payload (the SDK handles content type). For bulk scoring of files, use Batch Transform instead of paying for an idle endpoint. Attach target tracking auto scaling on invocation count so capacity follows load rather than guesswork.

Pitfalls and Interview Focus

Pitfalls and Interview Focus

Endpoints bill for every hour they run, including zero-traffic nights — right-size the instance, scale to zero outside business hours, or serve intermittent traffic with Serverless Inference. Payload and latency limits vary by instance family; profile with realistic request sizes, not tiny samples.

Managed Spot Training can cut training cost substantially (AWS advertises up to 90%) — enable checkpointing so interrupted jobs resume instead of restart. Version models in the registry and shift traffic with production variants for A/B tests rather than overwriting endpoints. Set up Model Monitor: feature drift hides in "it still returns 200."

Interview: explain the deploy decision — real-time vs batch vs serverless — from traffic pattern, latency, and cost.

Quiz

1. When should you prefer Batch Transform over a real-time endpoint?

Question 1 options

2. Why enable checkpointing with Managed Spot Training?

Question 2 options

3. What is the main cost risk of a real-time endpoint?

Question 3 options

Flashcards

Question

Training job outputs

Answer

Model artifact written to S3 plus metrics/logs — version it in the model registry.

Question

Real-time vs batch transform

Answer

Endpoint: per-request latency SLAs. Batch: offline bulk scoring, no idle instance cost.

Question

Managed Spot Training

Answer

Spot instances for training with big discounts; needs checkpointing to survive interruptions.

Question

Production variants

Answer

Traffic-split versions on one endpoint for A/B tests without a second deployment.

Question

Model Monitor

Answer

Watches input feature drift and prediction quality against baselines.

Revision Notes

Key Takeaways

  • 1. SageMaker manages the loop; you own data quality and model decisions
  • 2. Endpoints bill while idle — match serving mode to traffic shape
  • 3. Version, split traffic, and monitor drift instead of overwriting endpoints

Interview Tips

  • • Answer serving questions with a three-way tradeoff: latency, traffic pattern, cost (endpoint/batch/serverless)
  • • Show you know operational ML: registry versions, canary shifts, drift alarms, checkpointed spot jobs

Cheat Sheet

SageMaker: S3 data → processing → training (spot+checkpoints) → registry → endpoint/batch. Endpoints bill idle → autoscale or serverless. Variants for A/B; Model Monitor for drift.

Continue Learning

Before You Start

  • No prerequisites listed.

Next Topics