CertNote/ Commute Study Notes
Roadmap
KOEN
CLF-C02 · FoundationalCloud Practitioner - Foundational
DVA-C02 · AssociateDeveloper - Associate
SAA-C03 · AssociateSolutions Architect - Associate
SOA-C02 · AssociateCloudOps Engineer - Associate
SAP-C02 · ProfessionalSolutions Architect - Professional
DOP-C02 · ProfessionalDevOps Engineer - Professional
Linux Master 2 · 2급KAIT Linux Master - Level 2
SCS-C03 · SpecialtySecurity - Specialty
Linux Master 1 · 1급KAIT Linux Master - Level 1
MLA-C01 · AssociateMachine Learning Engineer - Associate
  • Week 1
    • 1.The ML Lifecycle and the Role of the ML Engineer
    • 2.ML Problem Types and Evaluation Metric Basics
    • 3.AWS ML Stack at a Glance
    • 4.SageMaker Overview: Studio, Training/Inference, Built-in Algorithms
    • 5.Week 1 Comprehensive Review — ML Fundamentals & AWS Stack
  • Week 2
  • Week 3
  • Week 4
  • Week 5
  • Week 6
  • Week 7
  • Week 8
  • Week 9
  • Week 10
AIF-C01 · FoundationalAI Practitioner - Foundational
DEA-C01 · AssociateData Engineer - Associate
MLS-C01 · SpecialtyMachine Learning - Specialty
SQLD · 개발자SQL Developer (SQLD)

© CertNote · 주간랩스

  • About
  • Changelog
  • Contact
  • Terms
  • Privacy
← MLA-C01/Week 1/Day 4

Based on the MLA-C01 exam guide·Report an error

MLA-C01· AssociateWeek 1 · Day 4~27 min read

Day 4 - SageMaker Overview: Studio, Training/Inference, Built-in Algorithms

📌 Key Takeaways

  • Studio is an ML-specific IDE that separates compute from storage — code lives on EFS, and a kernel (instance) is attached only when you run it.
  • The permission structure is Domain (team boundary) → User Profile (individual/role). Permissions are divided by mapping a different IAM role to each profile.
  • Training happens in an ephemeral container — the instance shuts down automatically when it finishes, and Spot reduces cost.
  • Inference is chosen by traffic pattern: real-time / serverless / batch transform / asynchronous.
  • About 17 built-in algorithms let you skip writing model code. Tabular classification and regression = XGBoost is the default.

SageMaker Studio: An Integrated IDE for ML Work

SageMaker is not a single service but a collection of tools covering the entire ML lifecycle, and MLA-C01 questions come in the form of "which SageMaker feature do you use for this task?"

SageMaker Studio is a browser-based integrated development environment. You do notebooks, experiment tracking, pipelines, and model deployment on one screen. If VS Code is the IDE for general development, Studio is the IDE for ML.

The key difference between Studio and the older notebook instances is the separation of compute and storage.

CategoryNotebook instanceStudio
Code storageEBS attached to the instanceEFS (separate from the instance)
Execution resourcesInstance type fixedChoose and swap an instance per kernel
Changing typeMust restart the instanceJust swap the kernel
Idle costKeeps accruing as long as it's onZero compute cost when the kernel is shut down
CollaborationIndividual instancesDomain and shared spaces

You can write code on a CPU and swap to a GPU kernel only when training, and shut down kernels you aren't using to save cost.

# Start a SageMaker SDK session inside a Studio notebook
import sagemaker
session = sagemaker.Session()
role = sagemaker.get_execution_role()    # IAM role assigned to the notebook
bucket = session.default_bucket()        # default S3 bucket
print(region := session.boto_region_name)

The IAM role returned by get_execution_role() is important. Every SageMaker and S3 operation you do from the notebook runs with this role's permissions, so if permissions are insufficient, training or deployment fails with AccessDenied.

The separation of compute and storage is a core cost principle of cloud ML. Training needs a GPU for several hours, but writing code is fine on a CPU. If you tie the two together, expensive GPU cost accrues even while you are writing code. Studio separates code (EFS) from execution (on-demand kernels) so that you borrow "expensive resources only when you use them." This is Studio's cost advantage over notebook instances.

Domains and User Profiles: SageMaker's Permission Structure

To use SageMaker Studio, you must first create a Domain. A domain is the top-level boundary of a Studio environment, bundling one VPC, one authentication method, and shared storage (EFS). Usually there is one domain per organization (or team).

Inside a domain are User Profiles. There is one per user (or persona), and each has its own IAM role, home directory, and default settings.

Domain (organization/team boundary, shares VPC, EFS, authentication)
 ├─ User Profile: data-scientist-kim  (Role A: training permissions)
 ├─ User Profile: ml-engineer-lee     (Role B: training + deployment permissions)
 └─ Shared Space: team-collab         (shared space for collaboration)
LayerWhat it bundlesWhat it divides
DomainVPC, authentication method, EFS, default settingsIsolation per organization/team
User ProfilePersonal IAM role, home directoryPermissions per person/role
Shared SpaceA workspace multiple users use togetherResources for collaboration

This hierarchy appears on the exam because of permission separation. You map a different IAM role to each user profile, for example granting only training permissions to a data scientist and deployment too to an ML engineer. When a permission problem arises, you must trace "which role of which user profile has what permissions."

When creating a domain you choose a network mode. VPC only mode sends all traffic through the customer VPC, so you can block the internet and reach the SageMaker API through PrivateLink — it is the standard for regulated and security-sensitive environments. Public internet mode runs over an AWS-managed network, which is convenient but offers weaker control. If "data must not be exposed to the internet" appears in a financial or healthcare scenario, VPC only is the answer.

Training: It Happens in an Ephemeral Container

The core mechanism of SageMaker training is the Training Job. When you request training, SageMaker processes it in the following order.

   [fit() call]
        │
        v
  ① Provision instances (the specified type and count)
        │
        v
  ② Download/stream training data from S3
        │
        v
  ③ Run the training code inside the container
        │
        v
  ④ Save the model artifact (model.tar.gz) to S3
        │
        v
  ⑤ Instances shut down automatically  ← why GPU cost is billed only for the training time
from sagemaker.estimator import Estimator
 
estimator = Estimator(
    image_uri=sagemaker.image_uris.retrieve("xgboost", region, "1.7-1"),
    role=role,
    instance_count=2,                 # 2 or more for distributed training
    instance_type="ml.m5.xlarge",
    output_path=f"s3://{bucket}/models/",
    use_spot_instances=True,          # cut training cost by up to 90% with Spot
    max_wait=7200, max_run=3600,
)
estimator.fit({"train": f"s3://{bucket}/train/"})

use_spot_instances=True is a common technique for ML engineers to reduce training cost. Since training can resume from a checkpoint even if interrupted, it suits cheap Spot instances.

ParameterMeaningCaution
instance_countNumber of instances used for training2 or more means distributed training, effective only if the data is split into multiple files
use_spot_instancesUse Spot instancesCan be interrupted — configuring checkpoints is practically mandatory
max_runMaximum run time of the training itselfThe job is stopped if exceeded
max_waitMaximum time including the wait for SpotMust be at least max_run when using Spot
output_pathS3 location of the model artifactThe reference point for reproduction and deployment

⚠️ Pitfall: Spot is cheap, but it can be reclaimed at any time. Running a long training job on Spot without checkpoints means starting over from scratch on interruption, which is actually a loss. Choose Spot on seeing the clue "cost savings," but check whether interruption tolerance (checkpoints) is mentioned alongside it.

Inference: Four Options

There are four ways to serve a trained model depending on the traffic pattern. This is a comparison that is easy to confuse on MLA-C01.

OptionSuitable situationIdle costLatencyCharacteristics
Real-time endpointContinuous low-latency requestsYes (always running)MillisecondsAlways on
Serverless inferenceIntermittent, unpredictable trafficNoneCold start presentAuto scaling
Batch transformBulk inference on large dataNone (job ends)Not applicableNo endpoint needed
Asynchronous inferenceLarge payloads, long processingCan scale down to 0Includes queue waitQueue-based, results go to S3

You decide by the shape of the traffic.

  • "Thousands of requests per second, low latency" → real-time endpoint
  • "Score all customers once a day" → batch transform
  • "Comes in occasionally and idle cost is wasteful" → serverless inference
  • "Large inputs such as images or video and processing takes long" → asynchronous inference
# Deploy a real-time endpoint
predictor = estimator.deploy(
    initial_instance_count=1, instance_type="ml.m5.large",
    endpoint_name="churn-endpoint",
)
result = predictor.predict(payload)   # response in milliseconds
              Do requests keep coming in?
                   │
        ┌──── Yes ─┴── No ────────┐
        │                         │
  Is latency important?     Is it a large batch at once?
   │         │                │        │
  Yes        No              Yes       No
   │         │                │        │
Real-time  Async (large     Batch      Serverless
           inputs)          transform

Serverless inference is the classic trade-off of "zero idle cost vs cold-start latency." When there is no traffic, it scales instances down to zero and charges nothing, but on the next request a cold start occurs as a new container is brought up. For a service whose latency must be consistently low, choose a real-time endpoint (always running); if it is cost-sensitive and intermittent, choose serverless. This is the same structure as Lambda's cold-start trade-off.

Built-in Algorithms: 17 You Don't Have to Write Yourself

SageMaker provides about 17 proven algorithms as containers. You don't need to write model code; you only pass the data and hyperparameters. If you remember a representative one for each problem type, you can choose quickly on the exam.

Problem typeBuilt-in algorithmScenario keyword
Classification/regression (tabular)XGBoost, Linear Learner"Predict from structured data"
ClusteringK-Means"Group without labels"
Dimensionality reductionPCA"There are too many features"
Anomaly detectionRandom Cut Forest (RCF)"Detect abnormal patterns"
RecommendationFactorization Machines"Sparse user-item matrix"
Image classificationImage Classification"What the photo is"
Object detectionObject Detection"What is where in the photo"
Time-series forecastingDeepAR"Forecast future demand/values"
Topic modelingLDA, NTM"Automatically extract document topics"

What if the built-in algorithms don't fit? — The options widen in three steps.

ApproachWhat it providesWhen
Built-in algorithmAlgorithm + container, all by AWSA standard problem type applies
Script modeAWS-managed framework container + my training scriptA model I wrote with TensorFlow, PyTorch, etc.
Custom containerA Docker image I builtSpecial libraries or runtimes are needed

For "tabular data classification/regression," XGBoost is almost always the default answer.

⚠️ Pitfall: Built-in algorithms have input format requirements. Several algorithms support RecordIO-protobuf in addition to CSV, and the latter is advantageous for large-scale sequential training. In a scenario where "a built-in algorithm is used but fails because the data isn't ready," you can suspect a format or content-type mismatch.

Running an Endpoint with Multiple Models

When models grow to dozens or hundreds, it is inefficient to have an endpoint per model. SageMaker offers a way to host multiple models on a single endpoint.

ApproachStructureSuitable situation
Single-model endpoint1 endpoint = 1 modelA small number of main models with steady traffic
Multi-model endpointLoad many models onto 1 endpoint and load them on requestDozens to hundreds of models per customer or region
Production variantMultiple versions on one endpoint, traffic split by weightA/B testing, canary deployment
  • Multi-model eliminates the waste of keeping instances always allocated even for rarely used models.
  • In exchange, a model that hasn't been invoked for a long time may incur a load delay on its first request.
  • Adjusting variant weights is the means of carrying out the canary deployment we saw on Day 1.

Model Artifacts and the Registry

When a training job finishes, the artifact is saved to output_path in the form of model.tar.gz. This file is the material for deployment.

[Training Job] ──> s3://bucket/models/<job-name>/output/model.tar.gz
                          │
                          ├──> create [Model] (image + artifact + role)
                          │        │
                          │        ├──> real-time endpoint
                          │        └──> batch transform job
                          │
                          └──> [Model Registry] register versions, manage approval status

The Model Registry manages "which model versions are approved and can go to production." This is the point where an automated retraining pipeline places an approval step.

Common Mistakes in Training and Inference Operations

MistakeSymptomFix
Missing S3 permissions in the execution roleAccessDenied right after training startsAdd permissions for the target bucket to the role policy
Using Spot without configuring checkpointsRetrain from scratch on interruptionSpecify a checkpoint path
Setting max_run too shortTraining is stopped before completionLeave a margin over the expected training time
Running a real-time endpoint around the clock for intermittent trafficWasted idle costConsider serverless inference
Using an endpoint for bulk batch scoringUnnecessary always-on costSwitch to batch transform
Data is a single huge fileNot distributed in distributed trainingShard into multiple objects

In the next post, we wrap up Week 1 with a comprehensive review of the ML fundamentals and the AWS stack learned this week.

📖 Glossary

  • SageMaker Studio : A browser-based IDE specialized for ML that handles notebooks, experiments, pipelines, and deployment on one screen.
  • Compute-storage separation : A structure that keeps code in persistent storage and attaches execution resources only when needed. It eliminates idle cost.
  • Kernel : The instance that actually runs the notebook code. It can be swapped between CPU/GPU.
  • Domain : The top-level boundary of a Studio environment. A team-level fence bundling VPC, authentication, and shared storage.
  • User Profile : An individual account within a domain. Each has its own IAM role and home directory.
  • VPC only mode : A network setting that makes Studio traffic flow only through the customer VPC, preventing internet exposure.
  • Training Job : A one-off job that launches instances, trains, leaves the artifact in S3, and then shuts itself down.
  • Spot instance : An instance that uses spare capacity cheaply but can be reclaimed at any time. Used together with checkpoints.
  • Cold start : The initial delay when the first request arrives from an idle state because a container must be brought up anew.
  • Batch Transform : An inference method that scores large data in one go without an always-on endpoint and then finishes.

📝 Practice Questions

Click a choice to reveal the answer and explanation.

Question 1

SageMaker Studio's core cost advantage over traditional notebook instances is?

Question 2

You want data scientists to have only training permission and ML engineers to have deployment permission in SageMaker Studio. How to implement this?

Question 3

Why are SageMaker Training Job costs charged only for training time?

Question 4

"Once a day, batch-score all customers on churn prediction" — which inference option fits best?

Question 5

To solve a binary classification problem on tabular data with SageMaker built-in algorithms, the most standard default choice is?

PreviousAWS ML Stack at a GlanceWeek 1 · Day 3Next Week 1 Comprehensive Review — ML Fundamentals & AWS StackWeek 1 · Day 5

Official references

  • MLA-C01 official exam page(opens in a new tab)
  • Amazon SageMaker AI documentation(opens in a new tab)
  • Amazon VPC documentation(opens in a new tab)
  • AWS IAM documentation(opens in a new tab)
  • Amazon EFS documentation(opens in a new tab)
  • Amazon S3 documentation(opens in a new tab)

On this page

  • Key Takeaways
  • SageMaker Studio: An Integrated IDE for ML Work
  • Domains and User Profiles: SageMaker's Permission Structure
  • Training: It Happens in an Ephemeral Container
  • Inference: Four Options
  • Built-in Algorithms: 17 You Don't Have to Write Yourself
  • Running an Endpoint with Multiple Models
  • Model Artifacts and the Registry
  • Common Mistakes in Training and Inference Operations
  • Glossary
  • Practice Questions