Study guide

9.1 Production Deployment Patterns & Traffic Shifting

AWS Certified Machine Learning Engineer — Associate MLA-C01

Track your progress as you read

Finished sections get a check mark.

1 Chapter 1: Introduction & Exam Strategy

1.1 AWS MLA-C01 Blueprint, Format & Strategy 1.2 The Machine Learning Engineering Lifecycle on AWS

2 Domain 1: Data Ingestion & Storage Architecture for ML

2.1 Ingesting Batch and Streaming Data for ML 2.2 High-Performance Storage for Training and Inference 2.3 Data Cataloging, Governance, and Querying

3 Domain 1: Feature Engineering & Data Transformation

3.1 Distributed Feature Engineering with AWS Glue & DataBrew 3.2 Interactive Data Preparation with SageMaker Data Wrangler 3.3 Feature Management with SageMaker Feature Store

4 Domain 1: Data Quality, Integrity & Ground Truth Labeling

4.1 Data Validation, Schema Drift, and Quality Rules 4.2 Handling Missing Values, Outliers & Class Imbalance 4.3 Data Labeling with SageMaker Ground Truth & Ground Truth Plus

5 Domain 2: Model Selection & Framework Architecture

5.1 SageMaker Built-in Algorithms & Selection Criteria 5.2 Custom Models with Script Mode and BYOC 5.3 Foundation Models, JumpStart, and Amazon Bedrock

6 Domain 2: SageMaker Model Training & Hyperparameter Optimization

6.1 SageMaker Training Jobs & Cost Optimization 6.2 Distributed Training Strategies & Architectures 6.3 Hyperparameter Optimization with Automatic Model Tuning (AMT)

7 Domain 2: Model Evaluation, Tracking & Model Registry

7.1 ML Evaluation Metrics & Validation Strategies 7.2 Experiment Tracking with SageMaker Experiments 7.3 Model Governance with SageMaker Model Registry

8 Domain 3: SageMaker Inference Options & Endpoint Architecture

8.1 Real-Time, Serverless, and Asynchronous Inference 8.2 High-Throughput Offline Inference with Batch Transform 8.3 Multi-Model Endpoints (MME) & Multi-Container Endpoints (MCE)

9 Domain 3: Deployment Strategies & Infrastructure Scaling

9.1 Production Deployment Patterns & Traffic Shifting 9.2 Endpoint Auto-Scaling & Hardware Acceleration

10 Domain 3: MLOps Pipelines & Workflow Orchestration

10.1 SageMaker Pipelines Core Architecture 10.2 Advanced Pipeline Patterns & Integration 10.3 End-to-End MLOps CI/CD & Automated Retraining

11 Domain 4: Production Model Monitoring with SageMaker Model Monitor

11.1 Data Quality & Model Quality Monitoring 11.2 Model Bias & Model Explainability Drift 11.3 Operational Observability with Amazon CloudWatch

12 Domain 4: Responsible AI, Bias Detection & Governance

12.1 Pre-Training and Post-Training Bias with SageMaker Clarify 12.2 Model Documentation & Auditing with Model Cards & Dashboard 12.3 Safety, Guardrails & Generative AI Governance

13 Domain 4: ML Security, Network Isolation & Cost Optimization

13.1 IAM Roles and Least Privilege for ML 13.2 Network Isolation, VPC Endpoints & Data Encryption 13.3 ML Cost Optimization & Resource Governance

9.1 Production Deployment Patterns & Traffic Shifting

Key Takeaways Explain This Topic AI

SageMaker Production Variants host multiple model versions behind a single HTTPS endpoint, allowing traffic partitioning via InitialVariantWeight for A/B testing and dynamic zero-downtime weight adjustments via UpdateEndpointWeightsAndCapacities.

SageMaker Deployment Guardrails automate Blue/Green updates with three traffic shifting modes: AllAtOnce (100% immediate cutover post-health check), Canary (small initial step like 10% during a baking period before 100%), and Linear (equal incremental steps over time like 20% every 5 minutes).

Shadow Deployments replicate live production requests to a new model variant (Shadow Variant) where responses are discarded or logged for offline evaluation while only Live Variant responses are returned to callers, eliminating customer-facing risk.

Deployment Guardrails support automated CloudWatch rollback alarms (monitoring ModelLatency, Invocation5XXErrors, CPUUtilization, or custom business metrics) that abort deployment and roll back traffic immediately if thresholds are violated during the baking window.

Updating an endpoint configuration with Blue/Green guardrails provisions the new green fleet alongside the live blue fleet, executes health checks, and terminates the old fleet only after successful baking, maintaining high availability across Multi-AZ fleets throughout the transition.

Last updated: August 2026

Production Deployment Patterns & Traffic Shifting

Deploying machine learning models into mission-critical production environments requires resilient deployment strategies that eliminate downtime, mitigate customer-facing regression risk, and support continuous model improvement. In Amazon SageMaker, deploying a model update is not a blunt, high-risk server restart. Instead, SageMaker provides sophisticated orchestration mechanisms—including Production Variants , Deployment Guardrails (Blue/Green deployments with Canary and Linear shifting) , Shadow Deployments , and Automated CloudWatch Rollbacks .

For the AWS Certified Machine Learning Engineer — Associate (MLA-C01) exam, you must master the mechanics of traffic shifting, understand how to configure A/B testing across multiple production variants behind a single endpoint, select the appropriate guardrail strategy based on risk tolerance, and configure automated rollback alarms to protect SLA commitments.

1. Endpoint Configuration & Production Variants

In Amazon SageMaker, a real-time hosting endpoint is decoupled into three distinct architectural entities:

Model: Defines the container image in Amazon ECR, model artifact location in Amazon S3 ( model.tar.gz ), and environment variables.

Endpoint Configuration ( EndpointConfig ): Defines the hardware topography, including instance types, initial instance counts, data capture options, and one or more Production Variants .

Endpoint: The persistent HTTPS REST URL ( https://runtime.sagemaker.<region>.amazonaws.com/endpoints/<endpoint-name>/invocations ) that clients invoke. +-----------------------------------------------------------------------------------------+

  • | SAGEMAKER PRODUCTION VARIANTS ARCHITECTURE |
  • | |
  • | Client Invocations |
  • | | |
  • | v |
  • | [HTTPS SageMaker Endpoint URL] |
  • | | |
  • | +------------------------+------------------------+ |
  • | | Traffic Distribution via InitialVariantWeight | |
  • | | | |
  • | v (90% Traffic) v (10% Traffic) |
  • | +----------------------------+ +----------------------------+ |
  • | | Variant A (Champion Model) | | Variant B (Challenger Model| |
  • | | - Model: fraud-xgb-v1 | | - Model: fraud-xgb-v2 | |
  • | | - Instance: ml.c6i.xlarge | | - Instance: ml.c6i.xlarge | |
  • | | - Weight: 9.0 | | - Weight: 1.0 | |
  • | | - Instance Count: 4 | | - Instance Count: 2 | |
  • | +----------------------------+ +----------------------------+ |
  • +-----------------------------------------------------------------------------------------+
  • Production Variants for A/B Testing

A single SageMaker endpoint configuration can host up to 10 Production Variants . Each variant specifies a separate model, instance type, and instance count:

InitialVariantWeight : Determines the statistical ratio of incoming traffic routed to that specific variant. For example, setting Variant A weight to 9.0 and Variant B weight to 1.0 distributes 90% of live requests to Variant A and 10% to Variant B.

Direct Variant Invocation ( TargetVariant ): While traffic is distributed by weight by default, client applications can bypass weighted routing and target a specific variant directly by passing the TargetVariant HTTP header in the InvokeEndpoint API request (e.g., X-Amzn-SageMaker-Target-Variant: VariantB ).

Dynamic Traffic Rebalancing ( UpdateEndpointWeightsAndCapacities )

When conducting A/B tests or progressively promoting a challenger model, you do not need to create a new endpoint configuration or redeploy the endpoint to adjust traffic ratios. The UpdateEndpointWeightsAndCapacities API allows you to dynamically adjust variant weights and instance counts in real time without downtime: import boto3

sagemaker_client = boto3.client('sagemaker')

  • # Dynamically shift traffic: 50% to Variant A, 50% to Variant B
  • response = sagemaker_client.update_endpoint_weights_and_capacities(
  • EndpointName='fraud-detection-endpoint',
  • DesiredWeightsAndCapacities=[
  • {
  • 'VariantName': 'VariantA-XGBoostV1',
  • 'DesiredWeight': 0.5,
  • 'DesiredInstanceCount': 3
  • },
  • {
  • 'VariantName': 'VariantB-XGBoostV2',
  • 'DesiredWeight': 0.5,
  • 'DesiredInstanceCount': 3
  • }
  • ]
  • )

Important

A/B Testing vs. Blue/Green Deployments:

Production Variants (A/B Testing) are designed to evaluate model performance differences (e.g., business conversion, click-through rates, accuracy on real users) across two or more concurrently running models over an extended period.

Blue/Green Deployment Guardrails are designed for safe infrastructure cutovers when deploying a new endpoint configuration to replace an old one with automated rollback protection.

2. SageMaker Deployment Guardrails & Blue/Green Deployments

When updating an existing endpoint to use a new EndpointConfig (e.g., new model version, updated container image, or different instance family), SageMaker utilizes Deployment Guardrails to manage traffic shifting safely between the old fleet (Blue) and the new fleet (Green). +-----------------------------------------------------------------------------------------+

  • | SAGEMAKER BLUE/GREEN DEPLOYMENT PHASES |
  • | |
  • | [1. PROVISION GREEN FLEET] ---> SageMaker launches new instances with new config |
  • | | |
  • | v |
  • | [2. HEALTH CHECKS] ---> Verifies container initialization & /ping response |
  • | | If health checks fail, Green fleet is terminated. |
  • | v |
  • | [3. TRAFFIC SHIFTING] ---> Shifts traffic via AllAtOnce, Canary, or Linear |
  • | | |
  • | v |
  • | [4. BAKING PERIOD] ---> Monitors CloudWatch alarms (e.g., 15-30 min) |
  • | | If ALARM triggers -> AUTO-ROLLBACK to Blue Fleet. |
  • | v |
  • | [5. PROMOTION & CLEANUP] ---> 100% on Green fleet -> Blue fleet terminated. |
  • +-----------------------------------------------------------------------------------------+
  • Blue/Green Traffic Shifting Modes

SageMaker supports three distinct traffic shifting options within DeploymentConfig : +-----------------------------------------------------------------------------------------+

  • | TRAFFIC SHIFTING STRATEGIES COMPARED |
  • | |
  • | 1. ALL AT ONCE |
  • | Traffic: [ Blue: 100% ] -------- Health Checks Pass --------> [ Green: 100% ] |
  • | |
  • | 2. CANARY (e.g., 10% Canary Step, 15 min Baking Period) |
  • | Step 1: [ Blue: 90% | Green: 10% ] <--- (Baking Period: 15 min) |
  • | Step 2: [ Blue: 0% | Green: 100% ] (If no CloudWatch alarms trigger) |
  • | |
  • | 3. LINEAR (e.g., 20% Step Value, 5 min Step Interval) |
  • | Step 1: [ Blue: 80% | Green: 20% ] <--- 5 min |
  • | Step 2: [ Blue: 60% | Green: 40% ] <--- 5 min |
  • | Step 3: [ Blue: 40% | Green: 60% ] <--- 5 min |
  • | Step 4: [ Blue: 20% | Green: 80% ] <--- 5 min |
  • | Step 5: [ Blue: 0% | Green: 100% ] (Complete) |
  • +-----------------------------------------------------------------------------------------+
  • Detailed Comparison Table

Traffic Shifting Mode Traffic Shift Mechanism Risk Profile Total Cutover Time Ideal Production Scenario

AllAtOnce 100% of traffic is switched to the Green fleet instantaneously after container health checks pass. Moderate (Exposes all traffic immediately if latent runtime bugs exist). Fast (Immediate post-health check). Development/staging environments, non-critical workloads, or urgent security patches where fast cutover is paramount.

Canary Shifts a small initial percentage (e.g., 5–15%) to Green for a specified baking window (e.g., 15–30 min). If healthy, shifts the remaining traffic in a single final step. Low (Limits potential customer impact to the small canary slice during evaluation). Moderate (Canary baking window + cutover). Production workloads where you want to test new model weights with minimal blast radius before full enterprise cutover.

Linear Shifts traffic in incremental step percentages (e.g., 20% every 5 minutes) across multiple steps until 100% is reached. Lowest (Gradual, continuous risk absorption across stepped intervals). Longest (Number of steps × step interval duration). High-volume, mission-critical production services where traffic increases must be gradual to verify backend dependencies.

3. Shadow Deployments (Dark Launching / Request Mirroring)

A Shadow Deployment allows you to evaluate a new model variant (Shadow Variant) under true production conditions—with real traffic volume, concurrency, and real-world payload distributions—with zero risk to the end-user experience. +-----------------------------------------------------------------------------------------+

  • | SAGEMAKER SHADOW DEPLOYMENT FLOW |
  • | |
  • | Client Request |
  • | | |
  • | v |
  • | [HTTPS SageMaker Endpoint] |
  • | | |
  • | +-------------------------+-------------------------+ |
  • | | Request Duplicated / Mirrored by SageMaker Engine | |
  • | | | |
  • | v (Live Request) v (Mirrored Copy) |
  • | +--------------------------+ +--------------------------+ |
  • | | LIVE VARIANT | | SHADOW VARIANT | |
  • | | (Current Production) | | (New Model V2) | |
  • | +--------------------------+ +--------------------------+ |
  • | | | |
  • | v v |
  • | [Prediction Response] [Response Discarded / S3] |
  • | | | |
  • | v v |
  • | Returned to Client! Captured for Offline Analysis |
  • | (SLA & Accuracy Safe) (Latency & Accuracy Comparison) |
  • +-----------------------------------------------------------------------------------------+

Operational Mechanics of Shadow Mode:

Dual Execution: SageMaker duplicates incoming requests in parallel. One copy is sent to the Live Variant, and an identical mirrored copy is sent to the Shadow Variant.

Response Handling: The Live Variant processes the request and returns its prediction to the calling application. The Shadow Variant's response is never returned to the caller ; it is discarded or captured to Amazon S3 via SageMaker Data Capture.

Independent Performance Tracking: Amazon CloudWatch tracks latency, error rates, and resource utilization metrics separately for both variants (e.g., ModelLatency for LiveVariant vs. ModelLatency for ShadowVariant ).

Promotion: Once the engineering team verifies that the Shadow Variant meets latency SLAs, memory constraints, and prediction parity over several days, the Shadow Variant can be promoted to the Live Variant with zero downtime.

Tip

Exam Scenario Rule: If an exam question asks to "test a new model against live production traffic, validate latency, resource utilization, and prediction quality without any risk of serving erroneous predictions to customers," choose Shadow Deployment .

4. Automated Rollbacks with Amazon CloudWatch Alarms

Deployment guardrails achieve zero-downtime safety through automated monitoring and rollback triggers during the deployment's baking period .

Configuring CloudWatch Auto-Rollback Alarms

When defining the DeploymentConfig , you attach CloudWatch alarms to the AutoRollbackConfiguration . If any specified CloudWatch alarm enters the ALARM state during traffic shifting or the baking window, SageMaker immediately halts the deployment and initiates an automatic rollback. +-----------------------------------------------------------------------------------------+

  • | AUTOMATED ROLLBACK DECISION TREE |
  • | |
  • | [Traffic Shifting Active] ---> Canary: 10% Green / 90% Blue |
  • | | |
  • | +----------------- CloudWatch Alarm Fires? ----------------+ |
  • | | | |
  • | v (YES: e.g., 5XX Errors > 1% or Latency > 150ms) v (NO) |
  • | [ABORT DEPLOYMENT] [BAKING COMPLETES] |
  • | 1. Instant 100% traffic rerouted to Blue Fleet 1. Shift 100% to Green |
  • | 2. Green Fleet terminated automatically 2. Terminate Blue Fleet|
  • | 3. Zero customer downtime; endpoint remains healthy 3. Deployment Succeeded|
  • +-----------------------------------------------------------------------------------------+

Critical CloudWatch Metrics for Rollback Alarms:

Invocation5XXErrors : Server-side model failures, container crashes, or unhandled exceptions.

Invocation4XXErrors : Client-side errors, payload schema mismatches, or serialization faults.

ModelLatency : The time taken by the model container to generate and return a prediction (detects performance regressions).

OverheadLatency : The time taken by SageMaker routing infrastructure before and after container execution.

CPUUtilization / GPUUtilization / MemoryUtilization : Hardware saturation indicating resource leaks.

Example: Boto3 Endpoint Update with Canary Guardrails & Rollback Alarms import boto3

sagemaker_client = boto3.client('sagemaker')

  • response = sagemaker_client.update_endpoint(
  • EndpointName='fraud-detection-realtime',
  • EndpointConfigName='fraud-detection-v2-config',
  • DeploymentConfig={
  • 'BlueGreenUpdatePolicy': {
  • 'TrafficRoutingConfiguration': {
  • 'Type': 'CANARY',
  • 'CanarySize': {
  • 'Type': 'CAPACITY_PERCENT',
  • 'Value': 10 # Route 10% traffic to Green fleet
  • },
  • 'WaitIntervalInSeconds': 900 # 15-minute baking period
  • },
  • 'TerminationWaitInSeconds': 300, # 5 minutes before Blue teardown
  • 'MaximumExecutionTimeoutInSeconds': 3600
  • },
  • 'AutoRollbackConfiguration': {
  • 'Alarms': [
  • {'AlarmName': 'FraudModel-High5XXErrors'},
  • {'AlarmName': 'FraudModel-HighModelLatency'}
  • ]
  • }
  • }
  • )

Loading diagram... SageMaker Production Deployment Patterns & Guardrails Flow