This lesson demonstrates how to use the SageMaker Model Registry to track model artifacts, manage versions, and deploy approved models. The examples are executed from a Jupyter notebook in SageMaker Studio and use the SageMaker Python SDK along with Boto3. We will:Documentation Index
Fetch the complete documentation index at: https://notes.kodekloud.com/llms.txt
Use this file to discover all available pages before exploring further.
- register a model artifact as a model package,
- register that model into the SageMaker Model Registry with an approval status, and
- approve a model version and obtain the latest approved model for deployment.

- create a legacy model package using Model.create,
- register a model into the Model Registry using Model.register,
- list and obtain the latest approved package from the registry, and
- deploy the approved package to an endpoint.


1. Imports and session setup
Start by importing required libraries and creating a SageMaker session and role reference. This session object is used throughout the notebook for SDK operations.2. Legacy model package (Model.create)
If you already have a trained model artifact saved in S3 and want a quick way to create a SageMaker model package (legacy flow), callModel.create() by supplying the S3 model artifact and the appropriate container image for the framework.
- model artifact (output of a training job)
- container image URI for the training framework (for example, Linear Learner)
model.create(), the model package shows up in the SageMaker console under Inference → Models, and you can create an endpoint directly from that model object for quick testing.


Model.create is great for rapid prototyping and one-off endpoints. For production tracking, reproducibility, and approval workflows, prefer the SageMaker Model Registry with Model.register.
3. Model Registry: create a Model Package Group and register a model version
The Model Registry stores model versions inside a Model Package Group and provides metadata, metrics, versioning, lineage, and approval workflows. Use the Boto3 SageMaker client to create a model package group, then callModel.register() to add a model version.
Create the package group:
PendingManualApproval) and attach any custom metadata you want to track.

- Metrics collected during training (MAE, MSE, R2, etc.),
- Artifacts (training and validation datasets, model artifact S3 paths),
- Hyperparameters used during training,
- The container image associated with the model,
- Activity feed (registration, approval, deployment events),
- Lineage that links datasets, training jobs, and containers to the model.

4. Approve a model version (in the UI) and deploy the latest approved version
Once a model version is approved in the Model Registry UI (for example, change status fromPendingManualApproval → Approved), you can programmatically find the latest approved version and deploy it.
Approving a model should follow your organization’s validation and governance processes. Only approve models that meet performance, fairness, and security requirements.



Quick comparison: Model.create vs Model.register
| Resource | Use Case | Benefits |
|---|---|---|
| Model.create (legacy model package) | Rapid prototyping, one-off endpoints | Fast, minimal workflow to create a model package and deploy |
| Model.register + Model Registry | Production model lifecycle, versioning, governance | Versioning, approval workflows, metrics, lineage, metadata, reproducibility |
Summary
- Model.create is a quick, legacy method to create model packages for prototyping and rapid testing.
- Model.register combined with the SageMaker Model Registry is the recommended approach for production: it provides robust versioning, approval workflows, stored metrics, activity logs, and lineage for reproducibility.
- After a model version is approved in the registry, you can programmatically fetch the latest approved package and deploy it as a real-time endpoint.
Links and references
- SageMaker Model Registry: https://docs.aws.amazon.com/sagemaker/latest/dg/model-registry.html
- SageMaker Python SDK: https://sagemaker.readthedocs.io/
- Boto3 SageMaker client: https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/sagemaker.html
- SageMaker Hosting (endpoints and batch transforms): https://docs.aws.amazon.com/sagemaker/latest/dg/deploy-model.html