Lesson 4 of 4 Foundation Model Customization Lifecycle

Automating Model Deployment, Rollback and Retirement

This lesson explains how automated pipelines with gradual traffic shifting and alarms make model deployments safe, and how lifecycle management replaces models before they are retired.

Learning outcomes

After completing this lesson, you will be able to:

  • Build an automated deployment pipeline for approved versions.
  • Roll back automatically with deployment guardrails.
  • Plan for model lifecycle states and retirement.

Automated deployment pipelines

Deploying a customised model by hand is slow and error-prone, so approved versions are deployed by an automated pipeline. The pipeline starts when a model version's status changes to Approved, an event that Amazon EventBridge can detect. It creates a new SageMaker AI model and endpoint configuration, or updates an inference component, and deploys to a staging endpoint. There it runs smoke tests, which check that the endpoint responds in the expected format, and an evaluation on a golden dataset, which checks that quality meets the threshold. Only if both pass does it deploy to production, often with a gradual traffic shift.

The pipeline is built with SageMaker Pipelines, AWS CodePipeline with CodeBuild steps, or AWS Step Functions, and every resource it creates is defined in infrastructure as code, so that staging and production are configured identically and a failed release can be repeated or reversed reliably.

The following diagram shows the stages of an automated deployment pipeline for a customised model.

An automated deployment pipeline for a customised model. The Approved event starts the pipeline, which creates the model and endpoint configuration, deploys to staging, runs smoke tests and a golden dataset evaluation, and only then deploys to production with a gradual traffic shift. A failed test stops the release.
Infrastructure as code keeps staging and production identical.

Deployment guardrails and rollback

SageMaker AI deployment guardrails update an endpoint with blue/green traffic shifting: all at once, canary (a small share first, then the rest) or linear (equal steps). A baking period follows each step, and if any specified CloudWatch alarm, such as model latency, error rate or a custom quality metric, goes into the ALARM state, SageMaker AI rolls traffic back to the old fleet automatically. Rolling deployments update capacity in batches, which avoids provisioning a full second fleet of expensive GPU instances.

For Bedrock-hosted custom models and prompts, rollback means pointing the application back to the previous custom model or Provisioned Throughput through configuration (for example AppConfig) or an alias. Keeping the previous version deployable until the new one is proven is essential. The following table compares the traffic-shifting options.

ModeTraffic shiftTrade-off
All at once (blue/green)100% after baking on the new fleetFast; every user exposed at once
CanarySmall share, then the restLimits exposure; slower
LinearEqual steps with bakingGradual; slowest
RollingBatches of instances replacedNo double capacity; mixed versions during rollout

The following diagram shows a canary deployment of a new model version rolling itself back when an alarm fires.

A canary deployment that rolls itself back. A small share of traffic goes to the new model version, a baking period watches the alarms, and when the p90 latency alarm fires because responses are 40% longer, SageMaker AI shifts traffic back to the previous version automatically. Only the canary share of users was affected.
The alarms are chosen before deployment, not after the problem appears.
Match the pairs

Traffic shifting modes

Exam skills 1.2.4 · 2.2.1

Match each SageMaker AI deployment guardrail mode with how it shifts traffic.

Log in to try this activity Interactive activities are free with an account.

Lifecycle management and model retirement

Base models have a lifecycle. Amazon Bedrock labels each model Active, Legacy or end of life (EOL), and the state appears in the console and in the modelLifecycle field of the GetFoundationModel and ListFoundationModels responses. An Active model is fully supported. A Legacy model is scheduled for retirement and has an announced EOL date, usually at least six months after it enters the Legacy state. After the EOL date, requests to the model fail, and migration never happens automatically.

The Legacy state already restricts use. New customers cannot start using a Legacy model, and existing customers can lose access after 15 days without invocations. New Provisioned Throughput and new fine-tuning jobs cannot be created on it, although existing custom model deployments and Provisioned Throughput keep working until EOL. For many models, the later part of the Legacy period is a public extended access period in which the provider can charge higher prices. Custom models built on a retiring base model must therefore be rebuilt on a replacement well before the EOL date. The following list summarises the effect of each state.

  • Active: available for new and existing customers, Provisioned Throughput and customisation.
  • Legacy: usable until the EOL date by existing users, with no new Provisioned Throughput or fine-tuning jobs and possibly higher prices during public extended access.
  • EOL: removed from the listed Regions; requests fail.

Lifecycle management therefore keeps an inventory of every model in use (base model, custom models, adapters and the applications that use them), tracks retirement dates, re-runs the evaluation suite on candidate replacements well before the date, retrains customisations if needed, migrates traffic gradually and finally deletes retired endpoints, Provisioned Throughput and artefacts to stop cost.

The following diagram shows the lifecycle states and what Legacy restricts.

The Amazon Bedrock model lifecycle. An Active model is fully supported. A Legacy model has an announced end-of-life date, usually at least six months later, and restricts new use. After the EOL date requests fail, and migration never happens automatically.
Some models have a public extended access period late in the Legacy state.

15days

Without invocations before existing customers can lose access to a Legacy model

Select all that apply

A model enters Legacy

Exam skills 1.2.4

A base model used by your application and by a fine-tuned custom model has moved to the Legacy state. Choose the true statements.

Log in to try this activity Interactive activities are free with an account.
Worked example

A failed canary

A new fine-tuned model version passes offline evaluation, but on live traffic its responses are 40% longer, raising latency. The team wants such problems contained and reverted without manual action.

The deployment should use canary traffic shifting with a baking period and auto-rollback alarms on p90 latency and output token count. When the alarm fires during the canary, SageMaker AI shifts traffic back to the previous version, and only the canary share of users was affected.

Check yourself

Which deployment style avoids temporarily doubling the GPU capacity of an endpoint?

Show answer

A rolling deployment, which replaces capacity in batches instead of building a complete new fleet.

Exam Tips

Remember for the exam

  • Deploy approved versions through IaC pipelines with staging tests.
  • Canary or linear shifting with CloudWatch alarms gives automatic rollback.
  • Rolling deployments avoid doubling GPU capacity.
  • Track base model Legacy and EOL dates and migrate before retirement.