Fatskills
Practice. Master. Repeat.
Study Guide: Cloud ML - AWS Certified Machine Learning Engineer – Associate (MLA-C01): High Availability and Fault Tolerance for ML Pipelines
Source: https://www.fatskills.com/machine-learning-101/chapter/cloud-ml-cert-aws-ml-high-availability-and-fault-tolerance-for-ml-pipelines

Cloud ML - AWS Certified Machine Learning Engineer – Associate (MLA-C01): High Availability and Fault Tolerance for ML Pipelines

By Fatskills Exam Guides Team — the exam nerds behind 28,500+ quizzes and 2.1M practice questions across 500+ global exams.

⏱️ ~8 min read

AWS_ML – High Availability and Fault Tolerance for ML Pipelines


AWS Certified Machine Learning – Specialty: High Availability & Fault Tolerance for ML Pipelines

Study Guide for Data Engineers & ML Practitioners


What This Is

High availability (HA) and fault tolerance (FT) in ML pipelines ensure your models, data, and inference endpoints stay operational despite failures—whether from hardware crashes, network issues, or sudden traffic spikes. Real-world scenario: A fraud detection system processes 10,000 transactions per second. If the inference endpoint fails, the business loses money and customer trust. HA/FT patterns (like multi-AZ deployments, retries, and dead-letter queues) keep the pipeline resilient. This guide covers AWS services and patterns to design ML systems that survive failures without manual intervention.


Key Terms & Services

  • Amazon SageMaker Multi-Model Endpoints (MME):
    AWS service that hosts multiple models behind a single endpoint, auto-scaling based on traffic. Ideal for A/B testing or cost-efficient hosting of many small models (e.g., per-customer recommendation models).

  • SageMaker Inference Recommender:
    AWS tool that benchmarks your model’s performance (latency, throughput) across instance types and recommends the best configuration for HA/FT (e.g., "Use ml.g5.2xlarge for 99.9% uptime at 100 TPS").

  • AWS Step Functions (Express Workflows):
    Serverless orchestration service for ML pipelines. Express Workflows are ideal for short-lived, high-throughput pipelines (e.g., real-time feature engineering + inference). Supports retries, timeouts, and error handling.

  • Amazon EventBridge Pipes:
    Fully managed ETL service that connects sources (Kinesis, SQS) to targets (Lambda, SageMaker) with built-in retries, batching, and dead-letter queues (DLQ). Critical for fault-tolerant data ingestion.

  • SageMaker Model Monitor:
    Continuously checks for data drift, concept drift, and model performance degradation. Triggers alerts (via SNS) or auto-rollbacks if accuracy drops below a threshold.

  • Amazon Kinesis Data Streams (Enhanced Fan-Out):
    Real-time data streaming with Enhanced Fan-Out for low-latency, high-throughput processing (e.g., fraud detection). Supports multi-AZ replication and retries for failed records.

  • AWS Glue Streaming ETL:
    Serverless Spark engine for real-time ETL. Use for fault-tolerant feature engineering (e.g., aggregating clickstream data). Integrates with Kinesis/SQS and supports checkpointing.

  • SageMaker Processing Jobs (with Retries):
    Managed environment for data preprocessing, model evaluation, or batch inference. Configure retries (e.g., MaxRetries=3) for transient failures (e.g., S3 throttling).

  • Amazon SQS (Dead-Letter Queues - DLQ):
    Decouples pipeline components (e.g., feature store writes → inference). DLQs capture failed messages for later analysis (e.g., "Why did 5% of transactions fail to process?").

  • SageMaker Shadow Testing:
    Deploys a new model version alongside the current one (same endpoint) to compare performance before full rollout. Reduces risk of downtime from bad updates.

  • AWS Auto Scaling (for SageMaker Endpoints):
    Dynamically adjusts the number of inference instances based on CloudWatch metrics (e.g., CPUUtilization > 70%). Ensures HA during traffic spikes.

  • Multi-AZ Deployments (SageMaker, RDS, ElastiCache):
    Replicates resources across Availability Zones (AZs). For ML, this means:

  • SageMaker endpoints in multiple AZs (auto-failover).
  • RDS/Redshift for feature stores (read replicas in other AZs).
  • ElastiCache (Redis) for low-latency feature lookups (multi-AZ cluster mode).


Step-by-Step: Building a Fault-Tolerant ML Pipeline

Scenario: A real-time recommendation system for an e-commerce site. Requirements: - 99.9% uptime for inference.
- Handle 10K requests/sec with <100ms latency.
- Recover from failures without manual intervention.

Step 1: Design the Data Ingestion Layer (Fault-Tolerant Streaming)

  1. Use Kinesis Data Streams with Enhanced Fan-Out for low-latency event capture (e.g., user clicks, purchases).
  2. Enable server-side encryption (SSE) and multi-AZ replication.
  3. Configure retries for failed records (e.g., RetryDuration=300s).
  4. Add a DLQ (SQS) to capture failed records (e.g., malformed JSON).
  5. Example: kinesis → Lambda (process) → SQS DLQ (if Lambda fails).
  6. Use EventBridge Pipes to route data to SageMaker Feature Store or S3.
  7. Set up batching (e.g., 100 records per batch) and retries (e.g., MaxAttempts=5).

Step 2: Build a Resilient Feature Store

  1. SageMaker Feature Store (Online Store):
  2. Create a feature group with OnlineStoreConfig enabled.
  3. Enable multi-AZ replication for HA.
  4. Use TTL (Time-to-Live) to auto-expire stale features (e.g., ttl=30d).
  5. Backup to S3 (Offline Store):
  6. Configure Glue Crawlers to catalog features in Athena for batch training.
  7. Enable S3 versioning to recover from accidental deletions.

Step 3: Deploy Models with HA/FT

  1. SageMaker Endpoint Configuration:
  2. Use Multi-Model Endpoints (MME) if hosting multiple models (e.g., per-region recommendations).
  3. Enable auto-scaling with CloudWatch alarms (e.g., CPUUtilization > 60%).
  4. Deploy in multiple AZs (SageMaker does this by default for endpoints).
  5. Shadow Testing (Canary Deployments):
  6. Deploy a new model version with traffic splitting (e.g., 5% to new model, 95% to old).
  7. Use SageMaker Model Monitor to compare performance (latency, accuracy).
  8. Rollback Strategy:
  9. Configure CloudWatch Alarms to trigger a rollback if error rate > 1%.
  10. Use SageMaker’s UpdateEndpoint API to revert to the previous model.

Step 4: Orchestrate the Pipeline with Retries & Error Handling

  1. Step Functions (Express Workflows):
  2. Define a state machine for the pipeline (e.g., Ingest → Feature Store → Inference → Post-Processing).
  3. Add retries for transient failures (e.g., Retry: {ErrorEquals: ["Lambda.ServiceException"], MaxAttempts: 3}).
  4. Use catch blocks to route failed steps to a DLQ or SNS alert.
  5. SageMaker Processing Jobs:
  6. For batch inference, use Processing Jobs with RetryStrategy (e.g., MaxRetries=2).
  7. Store results in S3 with versioning for auditability.

Step 5: Monitor & Auto-Recover

  1. SageMaker Model Monitor:
  2. Set up data drift detection (e.g., "Feature user_age distribution changed by >10%").
  3. Configure SNS alerts for critical issues (e.g., "Model accuracy dropped by 20%").
  4. CloudWatch Dashboards:
  5. Track metrics like:
    • SageMaker:Invocations (endpoint traffic).
    • Kinesis:IteratorAge (stream lag).
    • Lambda:Errors (processing failures).
  6. Auto-Remediation:
  7. Use EventBridge Rules to trigger Lambda functions for common issues (e.g., "If Kinesis:IteratorAge > 5s, scale up the consumer Lambda").

Common Mistakes


Mistake 1: Assuming SageMaker Endpoints Are Always Multi-AZ

  • Correction: While SageMaker can deploy endpoints across multiple AZs, it’s not enabled by default for single-instance endpoints. Always:
  • Use at least 2 instances for production endpoints.
  • Enable auto-scaling to handle AZ failures.

Mistake 2: Not Using DLQs for Asynchronous Pipelines

  • Correction: Without a DLQ, failed messages (e.g., malformed data) are lost. Always:
  • Attach a SQS DLQ to Lambda, Kinesis, or EventBridge Pipes.
  • Set up CloudWatch Alarms for DLQ depth (e.g., "If DLQ has >100 messages, alert").

Mistake 3: Ignoring Retry Throttling in Step Functions

  • Correction: Step Functions retries can amplify failures (e.g., retrying a Lambda that’s throttled). Mitigate by:
  • Adding jitter (random delay between retries).
  • Using exponential backoff (e.g., BackoffRate=2).

Mistake 4: Storing Features Only in Online Store (No Offline Backup)

  • Correction: SageMaker’s Online Store is for real-time inference, but it’s not a backup. Always:
  • Enable the Offline Store (S3) for batch training and disaster recovery.
  • Use Glue Crawlers to catalog features in Athena.

Mistake 5: Not Testing Failure Scenarios

  • Correction: HA/FT is only as good as your testing. Always:
  • Chaos test your pipeline (e.g., kill a Lambda, simulate AZ failure).
  • Use AWS Fault Injection Simulator (FIS) to test resilience.


Certification Exam Insights


1. Service Selection Traps

  • Kinesis vs. SQS for ML Pipelines:
  • Kinesis = Ordered, high-throughput streams (e.g., clickstream data).
  • SQS = Decoupling, simple queues (e.g., batch inference jobs).
  • Trap: Picking SQS for real-time fraud detection (needs ordering → Kinesis).

  • SageMaker Processing vs. AWS Glue:

  • SageMaker Processing = ML-specific (e.g., feature engineering, model evaluation).
  • AWS Glue = General-purpose ETL (e.g., cleaning raw data in S3).
  • Trap: Using Glue for model evaluation (SageMaker Processing is better).

  • Step Functions Standard vs. Express:

  • Standard = Long-running, complex workflows (e.g., training + deployment).
  • Express = Short-lived, high-throughput (e.g., real-time inference).
  • Trap: Using Standard for a 5-step real-time pipeline (Express is cheaper/faster).

2. Key Constraints

  • SageMaker Endpoint Limits:
  • Max 100 models per Multi-Model Endpoint (MME).
  • Max 10GB model size (use SageMaker Neo to optimize larger models).
  • Kinesis Shard Limits:
  • 1 shard = 1MB/sec write, 2MB/sec read.
  • Trap: Under-provisioning shards for high-throughput pipelines.

3. "Which Service?" Scenarios

  • Scenario: "A team needs to deploy a model with 99.9% uptime and auto-rollback if accuracy drops. Which services?"
  • Answer: SageMaker Endpoints (multi-AZ) + Model Monitor + CloudWatch Alarms.
  • Why: Model Monitor detects drift, alarms trigger rollback via UpdateEndpoint.

  • Scenario: "A batch inference job fails intermittently due to S3 throttling. How to make it resilient?"

  • Answer: SageMaker Processing Jobs with RetryStrategy (e.g., MaxRetries=3).
  • Why: Built-in retries handle transient S3 errors.


Quick Check Questions


Question 1

A fintech company runs a real-time fraud detection model. The pipeline ingests 5K transactions/sec via Kinesis, processes them with Lambda, and writes to a SageMaker Feature Store. During peak hours, Lambda throttles, causing data loss. What’s the most cost-effective way to fix this? - A) Increase Lambda memory to 3GB.
- B) Replace Lambda with AWS Glue Streaming ETL.
- C) Add a SQS DLQ and configure Lambda retries.
- D) Use Kinesis Enhanced Fan-Out.

Answer: C) Add a SQS DLQ and configure Lambda retries.
Explanation: A DLQ captures failed records, and retries handle transient throttling. Glue (B) is overkill for simple processing, and Enhanced Fan-Out (D) doesn’t solve Lambda throttling.*


Question 2

A retail company deploys a recommendation model on SageMaker. During a Black Friday sale, traffic spikes to 20K requests/sec, causing latency to exceed 500ms. The team wants to auto-scale the endpoint without downtime. What’s the fastest solution? - A) Manually add more instances to the endpoint.
- B) Enable SageMaker auto-scaling with a CloudWatch alarm for CPUUtilization > 60%.
- C) Switch to a Multi-Model Endpoint (MME).
- D) Use AWS Fargate to host the model.

Answer: B) Enable SageMaker auto-scaling with a CloudWatch alarm.
Explanation: Auto-scaling dynamically adjusts instances based on traffic. MME (C) is for hosting multiple models, not scaling, and Fargate (D) is not a native SageMaker option.*


Last-Minute Cram Sheet

  1. SageMaker Endpoints: Multi-AZ by default only if you use ≥2 instances. ⚠️ Single-instance endpoints are not HA.
  2. Kinesis Shards: 1 shard = 1MB/sec write. Scale shards for throughput.
  3. Step Functions Retries: Use BackoffRate (e.g., 2) to avoid throttling storms.
  4. SageMaker Model Monitor: Detects data drift (input) and concept drift (output).
  5. DLQs: Always attach to Lambda, Kinesis, or EventBridge Pipes for failed records.
  6. SageMaker Processing Jobs: Supports RetryStrategy for transient failures (e.g., S3 throttling).
  7. Multi-Model Endpoints (MME): Max 100 models per endpoint. Use for cost-efficient hosting.
  8. Shadow Testing: Deploy new model versions alongside old ones to compare performance.
  9. EventBridge Pipes: Fully managed ETL with retries, batching, and DLQs. ⚠️ Not for complex transformations (use Glue instead).
  10. Auto-Scaling SageMaker: Use CloudWatch metrics like CPUUtilization or InvocationsPerInstance.


ADVERTISEMENT