Skip to content
Visual explainer 2h 30m to learn 5 steps

Train, register and host a model with SageMaker AI

Explain how SageMaker AI supports training, registration, hosting and monitoring, and when a foundation model API is enough.

By Invicly Tech, , in AWS Cloud Engineering. About 13 minutes to read.

Topic 35 of 38

In short

Amazon SageMaker AI (renamed from Amazon SageMaker in December 2024) is the AWS service for training, registering, hosting and watching your own machine learning models. You pay for the instances your jobs and endpoints use, and you own the data, the training code and the model quality. Many generative AI tasks are cheaper and faster with a foundation model API such as Bedrock; SageMaker AI earns its place when you need a model trained on your own labelled data or full control of how it is served.

Explained simply

Sometimes no ready-made model does the job. Say you want to predict which uploaded invoices will be paid late, based on your own history of past invoices. A general text model has never seen your customers or your payment patterns. You need to train a model on your own labelled data. Amazon SageMaker AI is the AWS service for that.

SageMaker AI rents you compute for each step. A training job starts machines, runs your training code on data in S3, saves the finished model back to S3, and shuts the machines down. You pay only while the job runs. An endpoint is different: it keeps machines running so the model can answer requests at any moment, and it bills all the time.

Between training and hosting sits the Model Registry. Think of it as a shelf of labelled jars. Every trained model becomes a new numbered version in a group, with its metrics attached. Someone, or an automated check, marks a version Approved before it may go to production. That way you can always say which model is live and why.

Models also get worse over time without anyone touching them, because the world changes. If customers start paying differently, yesterday's model makes worse guesses. Watching for that change, called drift, is the last step of the lifecycle. Then you retrain, register a new version and start again.

Press Play on a diagram to walk through it one step at a time.

CycleThe model lifecycle in SageMaker AI
  1. 1
    Train

    A training job reads data from S3 and writes a model artifact back to S3.

  2. 2
    Register

    The artifact becomes a version in a model package group with metrics.

  3. 3
    Approve

    A person or pipeline sets the version to Approved.

  4. 4
    Host

    Deploy to a real-time, serverless or asynchronous endpoint, or run batch transform.

  5. 5
    Monitor

    Capture inputs and predictions, compare with a baseline, alarm on drift.

  6. Back to step 1
MapChoosing where a model should come from
Need a prediction or generated text
  • General language task
    • Summarise, classify, extract
    • Call a Bedrock model with a prompt
  • Domain wording, same task
    • Try prompt examples first
    • Then consider fine-tuning
  • Your own tabular history
    • Train on SageMaker AI
    • XGBoost or scikit-learn often enough
  • Strict latency or placement
    • Host your own model
    • Real-time endpoint you size and scale
CompareSageMaker AI hosting choices
Real-time endpoint
  • Always-on instances
  • Lowest latency
  • Bills every hour it exists
  • Auto scaling available
Serverless or asynchronous
  • Scales down when idle
  • Cold starts or queued replies
  • Async: large payloads, long jobs
  • Serverless: no GPUs
Batch transform
  • No standing endpoint
  • Whole data set in S3
  • Runs then stops
  • Cheapest for nightly scoring

In depth

Training jobs: what you hand over and what you get back

A training job needs four things: a container image with the training framework (AWS provides images for scikit-learn, XGBoost, PyTorch and others, or you bring your own), your training script, input data in S3, and an instance type and count. It also needs an execution role that can read the input prefix and write the output prefix. SageMaker AI starts the instances, copies data in, runs the script, uploads model.tar.gz to the output path and stops everything. Logs go to CloudWatch Logs.

To cut cost, use managed spot training with checkpoints, start with the smallest instance that fits, and test locally first. The SageMaker Python SDK has a local mode that runs the same container on your laptop with Docker, so you can catch bugs before paying for cloud instances. For repeatable runs, SageMaker Pipelines chains processing, training, evaluation and registration steps.

  • Inputs: image, script, S3 data, instance type, role
  • Output: model.tar.gz in S3 plus metrics in logs
  • Local mode or plain scikit-learn first, cloud second

The Model Registry and approval

The Model Registry groups models into model package groups, one per business problem, such as late-payment-predictor. Each registration adds a numbered model version that points to the artifact, the inference image, and metadata such as evaluation metrics. You can show Model Card information on registered models, track lineage back to the training job, and organise groups into collections.

Every version has an approval status: PendingManualApproval, Approved or Rejected. Changing the status emits an EventBridge event. A common pattern is a rule that starts a CI/CD pipeline when a version becomes Approved, which then deploys it to a staging endpoint, runs tests and promotes it. That separates who trains models from who may put them in front of users.

FlowFrom pipeline run to production
  1. 1
    Pipeline trains

    Evaluation step writes metrics

  2. 2
    Register version

    Status PendingManualApproval

  3. 3
    Review

    Metrics beat the current version

  4. 4
    Set Approved

    EventBridge event fires

  5. 5
    CI deploys

    Staging, tests, then production

Hosting options and their trade-offs

Real-time endpoints keep one or more instances running behind an HTTPS API for low-latency answers. You can attach auto scaling. Serverless inference scales to zero between bursts, so you pay per request and duration, but the first request after idle time is slower and GPUs are not available. Asynchronous inference queues requests, writes results to S3 and suits payloads up to 1 GB and processing up to an hour; it can scale down to zero instances when the queue is empty. Batch transform has no endpoint at all: it reads a whole S3 data set, writes predictions and stops.

For the late-payment model, a nightly batch transform over the day's invoices is cheapest. If the upload screen must show a prediction instantly, use a small real-time or serverless endpoint. Whichever you pick, deleting the endpoint, endpoint configuration and model is part of cleanup.

Watching for drift today

Drift detection works by capturing live inputs and predictions, comparing them with a baseline built from the training data, and alerting when the gap passes a threshold. SageMaker Model Monitor did this as a managed feature, but AWS has closed it to new customers; existing users can keep it, with no new features planned.

For new designs, AWS points to a replacement built from parts you control: endpoint data capture to S3, open-source drift checks such as Evidently AI run on a schedule by EventBridge and Lambda or a pipeline step, results tracked in SageMaker AI MLflow, CloudWatch metrics and alarms for latency, errors and custom quality metrics, and optional QuickSight dashboards. For a lab, a scheduled job that compares this week's feature averages with the training averages and publishes one custom CloudWatch metric is enough to learn the idea.

  • Capture inputs and predictions
  • Baseline from training data
  • Scheduled comparison, alarm on threshold
  • Model quality needs ground truth labels, which often arrive late

When a foundation model API is enough

Training your own model means owning labelled data, training code, evaluation, hosting, monitoring and retraining. That is real, ongoing work. Before you start, ask whether a foundation model on Bedrock can do the job with a good prompt and a few examples. Summaries, classification into a handful of labels, field extraction and translation usually can.

Own a model when the prediction depends on patterns only your data contains, such as tabular history, when per-request cost must be tiny at very high volume, when latency must be a few milliseconds, or when rules require the model to run in a specific place under your control. A middle path is fine-tuning or adapting a foundation model, which both Bedrock and SageMaker AI support for some models.

Learn it in 5 short steps

About 30m each. Track them with a timer in your plan.

  1. 1
    Run a training job~30m
  2. 2
    Register a model version~30m
  3. 3
    Host on an endpoint~30m
  4. 4
    Monitor drift with data capture and CloudWatch~30m
  5. 5
    Compare with calling a foundation model~30m

Key points

  • Training jobs run on instances you choose and stop when the job ends; endpoints bill every hour they exist, busy or idle.
  • The Model Registry stores versions in model package groups with an approval status of PendingManualApproval, Approved or Rejected.
  • Choose real-time endpoints for low latency, serverless for spiky traffic that tolerates cold starts, asynchronous for large or slow requests, batch transform for whole data sets.
  • SageMaker Model Monitor is no longer open to new customers; AWS points new users to CloudWatch metrics plus open-source drift tools instead.
  • If a general model with a good prompt solves the task, calling Bedrock is usually less work than owning a training pipeline.

Key terms

Tap a card to flip it. 0/5 known

Examples

Registering and approving a model version from the CLI

A training job has written a model artifact to S3. Step 1: create a model package group once for the problem. Step 2: register the version, pointing at the inference image and artifact (the pipeline usually does this). Step 3: list versions to find its ARN. Step 4: after review, set it to Approved and check that an EventBridge rule or pipeline reacts. Evidence: the version shows ModelApprovalStatus Approved. Cleanup: groups and versions cost nothing to keep, but the artifacts in S3 do.

bash
aws sagemaker create-model-package-group \
  --model-package-group-name late-payment-predictor
aws sagemaker list-model-packages \
  --model-package-group-name late-payment-predictor \
  --query "ModelPackageSummaryList[].[ModelPackageArn,ModelApprovalStatus]"
aws sagemaker update-model-package \
  --model-package-arn <model-package-arn> \
  --model-approval-status Approved

A design-only lab that costs nothing

If you cannot pay for instances, run the lifecycle locally. Step 1: generate 1,000 synthetic invoices with amount, customer age and days late. Step 2: train a scikit-learn model and save it with a version number and its accuracy. Step 3: keep a small JSON registry file with version, metrics and status. Step 4: score a new batch and compare its average amount with the training average as a crude drift check. This mirrors train, register, approve, batch score and monitor. Then write down which SageMaker AI feature replaces each step.

python
import json, joblib, numpy as np
from sklearn.linear_model import LogisticRegression

rng = np.random.default_rng(7)
X = rng.normal([500, 3], [200, 2], size=(1000, 2))  # amount, customer years
y = (X[:, 0] > 600).astype(int)                     # synthetic late flag
m = LogisticRegression().fit(X, y)
joblib.dump(m, "model-v1.joblib")
reg = {"v1": {"accuracy": m.score(X, y), "status": "PendingManualApproval",
              "train_mean_amount": float(X[:, 0].mean())}}
json.dump(reg, open("registry.json", "w"), indent=2)
new = rng.normal([800, 3], [200, 2], size=(200, 2))
print("drift" if abs(new[:, 0].mean() - reg["v1"]["train_mean_amount"]) > 150 else "ok")

Quick reference

  • Amazon SageMaker AI is the new name (December 2024); CLI commands and APIs still use sagemaker
  • Training jobs stop when done; endpoints bill until deleted
  • Approval status values: PendingManualApproval, Approved, Rejected
  • Asynchronous inference: payloads up to 1 GB, processing up to one hour, results in S3
  • Serverless inference: scales to zero, cold starts, no GPUs
  • Model Monitor is closed to new customers; use data capture, CloudWatch and open-source drift checks
  • Cleanup: delete-endpoint, delete-endpoint-config, delete-model, then the S3 artifacts

Common mistakes

  • Leaving a test endpoint running overnight; it keeps billing for its instances until you delete it.
  • Deploying a model version straight from a notebook so nobody can tell which data and code produced it.
  • Planning a new design around Model Monitor schedules even though new accounts can no longer start using that feature.

Quick quiz

Pick an answer to see if you're right and why.

Question 1

1A team trains a model once a week and scores each day's invoices overnight. Which hosting choice is usually cheapest?

Question 2

2What does the Model Registry approval status mainly give you?

Question 3

3You are designing drift monitoring for a new account. What is the right plan?

Question 4

4Your task is to summarise uploaded text files. What should you try first?

0/4 answered

Practice exercises

Try each one yourself first. Use the hint if you get stuck, then compare with the solution.

  1. Exercise 1easy

    List any SageMaker AI endpoints in your sandbox Region and delete any you no longer need, with their configuration and model.

  2. Exercise 2medium

    For three workloads, choose a hosting option and justify it: (a) fraud score shown during checkout, (b) 10,000 scanned documents per night, (c) a demo used a few times a week.

  3. Exercise 3hard

    Design an approval-driven release for the late-payment model: which events, rules and steps move a newly approved version to production, and how do you roll back?

Check yourself

Answer in your head, reveal, then be honest with yourself.

Feel confident about this topic?

Frequently asked questions

Is SageMaker AI the same thing as Amazon SageMaker?
Amazon SageMaker AI is the ML service that used to be called Amazon SageMaker. The name Amazon SageMaker now covers a wider data, analytics and AI platform that includes SageMaker AI, SageMaker Unified Studio and Bedrock. APIs and CLI commands still use sagemaker.
Can I learn SageMaker AI without spending money?
Partly. Train small models locally with scikit-learn or the SDK's local mode, keep a file-based registry and practise the steps. If you use the cloud, pick small instances, set a budget alert and delete endpoints the same day.
Do I need GPUs to train a model?
Not for most tabular problems. Algorithms like XGBoost and logistic regression train quickly on CPU instances. GPUs matter for deep learning on images, audio or large text models.

Go deeper

ShareXLinkedInWhatsApp