Fatskills
Practice. Master. Repeat.
Study Guide: Cloud ML - AWS Certified Machine Learning Engineer – Associate (MLA-C01): Model Deployment (Real‑time Endpoints, Batch Transform, Multi‑model, Serverless)
Source: https://www.fatskills.com/machine-learning-101/chapter/cloud-ml-cert-aws-ml-model-deployment-realtime-endpoints-batch-transform-multimodel-serverless

Cloud ML - AWS Certified Machine Learning Engineer – Associate (MLA-C01): Model Deployment (Real‑time Endpoints, Batch Transform, Multi‑model, Serverless)

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 – Model Deployment (Real‑time Endpoints, Batch Transform, Multi‑model, Serverless)


AWS Certified Machine Learning – Specialty: Model Deployment Study Guide

(Real-time Endpoints, Batch Transform, Multi-model, Serverless)


What This Is

Model deployment is the process of integrating a trained ML model into production so it can make predictions on new data. In AWS, this means choosing between real-time endpoints (low-latency predictions for apps like fraud detection or chatbots), batch transform (offline predictions for large datasets, e.g., nightly customer churn scoring), multi-model endpoints (cost-efficient hosting for thousands of models, e.g., personalized recommendations), or serverless inference (scalable, pay-per-use predictions for sporadic traffic, e.g., a seasonal demand forecasting API). A poor deployment choice can lead to high costs, latency issues, or failed compliance (e.g., HIPAA/GDPR for healthcare models).


Key Terms & Services

  • Amazon SageMaker Real-Time Endpoints
    AWS’s fully managed service for deploying models as HTTPS APIs. Best for low-latency (<100ms), high-throughput predictions (e.g., fraud detection, real-time recommendations). Supports A/B testing, auto-scaling, and shadow testing (traffic mirroring).

  • SageMaker Batch Transform
    Offline inference service for processing large datasets (e.g., nightly batch jobs for customer segmentation). No persistent endpoint; spins up compute, runs predictions, and shuts down. Cost-effective for non-real-time use cases.

  • SageMaker Multi-Model Endpoints (MME)
    Hosts multiple models behind a single endpoint, loading/unloading models dynamically from S3. Ideal for cost savings when serving thousands of models (e.g., personalized models per customer). Uses container caching to reduce cold-start latency.

  • SageMaker Serverless Inference
    Pay-per-use inference with no provisioned instances. Scales to zero when idle, best for sporadic traffic (e.g., a chatbot used only during business hours). Max concurrency limit: 200 requests/endpoint (hard limit).

  • SageMaker Asynchronous Inference
    Handles large payloads (up to 1GB) or long-running predictions (up to 15 minutes). Queues requests and returns results via S3. Useful for video analysis or document processing.

  • SageMaker Inference Recommender
    Automates endpoint configuration (instance type, auto-scaling) by benchmarking model performance. Reduces guesswork for cost/latency tradeoffs.

  • SageMaker Model Monitor
    Detects data drift, concept drift, and bias in production endpoints. Alerts when model performance degrades (e.g., fraud detection accuracy drops due to new attack patterns).

  • AWS Lambda for Inference
    Serverless compute for lightweight models (e.g., scikit-learn, XGBoost). Max runtime: 15 minutes, payload limit: 6MB. Cheaper than SageMaker for low-volume predictions but lacks auto-scaling.

  • Elastic Inference (EI)
    Accelerates inference for deep learning models (e.g., PyTorch, TensorFlow) by attaching GPU acceleration to CPU instances. Reduces costs vs. full GPU instances.

  • SageMaker Neo
    Compiles models to optimized binaries for specific hardware (e.g., ARM, Intel). Reduces latency and cost (e.g., deploying a model to AWS IoT Greengrass for edge devices).

  • VPC Endpoints for SageMaker
    Securely connects SageMaker endpoints to private VPCs (e.g., for HIPAA-compliant healthcare models). Avoids public internet exposure.

  • SageMaker Pipelines
    Orchestrates ML workflows (training → deployment → monitoring). Ensures reproducibility and CI/CD for model updates.


Step-by-Step / Process Flow


1. Deploying a Real-Time Endpoint

Scenario: A fintech company needs a fraud detection API with <50ms latency.
1. Train & Package the Model
- Train a model (e.g., XGBoost) in SageMaker Notebooks or a training job.
- Save the model artifacts to S3 (e.g., s3://my-bucket/models/fraud-detection/).
- Create an inference script (inference.py) to handle predict() requests.
2. Create a Model in SageMaker
- Use the SageMaker Python SDK or AWS Console to define a model:
python
from sagemaker.xgboost import XGBoostModel
model = XGBoostModel(
model_data="s3://my-bucket/models/fraud-detection/model.tar.gz",
role=arn:aws:iam::123456789012:role/SageMakerRole,
entry_script="inference.py",
framework_version="1.3-1"
)
3. Deploy the Endpoint
- Choose an instance type (e.g., ml.m5.large for CPU, ml.g4dn.xlarge for GPU).
- Configure auto-scaling (e.g., min/max instances, target CPU utilization).
- Deploy:
python
predictor = model.deploy(
initial_instance_count=1,
instance_type="ml.m5.large",
endpoint_name="fraud-detection-endpoint"
)
4. Test & Monitor
- Send a test request:
python
response = predictor.predict({"input": [1.0, 2.0, 3.0]})

- Set up SageMaker Model Monitor to track drift.


2. Running Batch Transform

Scenario: A retail company needs to score 10M customers for churn risk nightly.
1. Prepare Input Data
- Store input data in S3 (e.g., s3://my-bucket/input/churn-data/).
- Ensure data is in CSV, JSON, or Parquet format.
2. Create a Batch Transform Job
- Use the SageMaker Python SDK:
python
from sagemaker.transformer import Transformer
transformer = Transformer(
model_name="churn-model",
instance_type="ml.m5.4xlarge",
instance_count=4,
output_path="s3://my-bucket/output/churn-results/"
)
transformer.transform(
data="s3://my-bucket/input/churn-data/",
content_type="text/csv",
split_type="Line"
)
3. Monitor & Retrieve Results
- Check job status in the SageMaker Console.
- Results are saved to the specified S3 output path.


3. Setting Up a Multi-Model Endpoint (MME)

Scenario: A SaaS company serves 10,000 personalized recommendation models (one per customer).
1. Upload Models to S3
- Store models in a prefix-based structure (e.g., s3://my-bucket/models/customer-1/, s3://my-bucket/models/customer-2/).
2. Create a Multi-Model Endpoint
- Use a single container (e.g., PyTorch or TensorFlow Serving) that can load models dynamically:
python
from sagemaker.multi_model import MultiDataModel
mme = MultiDataModel(
name="recommendation-mme",
model_data_prefix="s3://my-bucket/models/",
image_uri="763104351884.dkr.ecr.us-east-1.amazonaws.com/pytorch-inference:1.9.1-cpu-py38",
role=arn:aws:iam::123456789012:role/SageMakerRole
)
predictor = mme.deploy(
initial_instance_count=2,
instance_type="ml.m5.2xlarge"
)
3. Dynamically Load Models
- Invoke a specific model by specifying its S3 path:
python
response = predictor.predict(
data={"input": [1, 2, 3]},
target_model="customer-1/model.tar.gz"
)


4. Deploying with Serverless Inference

Scenario: A startup needs a chatbot API with unpredictable traffic (peaks during business hours).
1. Package the Model
- Ensure the model is <100MB (serverless has strict size limits).
- Use SageMaker Neo to optimize the model for serverless.
2. Deploy the Serverless Endpoint
python
from sagemaker.serverless import ServerlessInferenceConfig
serverless_config = ServerlessInferenceConfig(
memory_size_in_mb=4096, # Max 6144MB
max_concurrency=50 # Max 200
)
predictor = model.deploy(serverless_inference_config=serverless_config)
3. Test & Monitor
- Serverless scales to zero when idle (no cost when unused).
- Cold starts (~1-2s) may occur after inactivity.


Common Mistakes

Mistake Correction
Using Batch Transform for real-time predictions Batch Transform is for offline jobs. Use Real-Time Endpoints for <100ms latency.
Deploying a single-model endpoint for 10,000 models This is cost-prohibitive. Use Multi-Model Endpoints (MME) to share infrastructure.
Ignoring payload size limits in Serverless Inference Serverless has a 6MB payload limit. For larger payloads, use Asynchronous Inference or Batch Transform.
Not enabling auto-scaling for real-time endpoints Without auto-scaling, endpoints may throttle during traffic spikes or waste money when idle.
Storing models in EFS instead of S3 for MME MME requires models in S3 (not EFS) for dynamic loading.


Certification Exam Insights

  1. Service Selection Traps
  2. Real-Time vs. Batch vs. Serverless:
    • Real-Time Endpoint → Low-latency, persistent.
    • Batch Transform → Offline, large datasets.
    • Serverless Inference → Sporadic traffic, cost-sensitive.
  3. Multi-Model vs. Single-Model:


    • MME → Thousands of models, cost-efficient.
    • Single-Model → High-throughput, low-latency.
  4. Key Constraints

  5. Serverless Inference:
    • Max 6MB payload, 200 concurrent requests, 6144MB memory.
  6. Asynchronous Inference:
    • Max 1GB payload, 15-minute timeout.
  7. Batch Transform:


    • No persistent endpoint; max 100 concurrent jobs per account.
  8. Cost Optimization

  9. Elastic Inference (EI) → Cheaper than full GPU for DL models.
  10. Spot Instances → For Batch Transform (not real-time).
  11. SageMaker Inference Recommender → Automates instance selection.

  12. Security & Compliance

  13. VPC Endpoints → Required for HIPAA/GDPR compliance.
  14. IAM Roles → Least privilege for endpoints (e.g., no * permissions).

Quick Check Questions


Question 1

A healthcare company needs to deploy a HIPAA-compliant model for real-time patient risk scoring. The model must handle 100 requests/second with <50ms latency. Which deployment option meets these requirements? - A) SageMaker Batch Transform - B) SageMaker Real-Time Endpoint with VPC Endpoint - C) AWS Lambda - D) SageMaker Serverless Inference

Answer: B) SageMaker Real-Time Endpoint with VPC Endpoint
Explanation: Real-Time Endpoints support low-latency, high-throughput predictions, and VPC Endpoints ensure HIPAA compliance by keeping traffic private.*


Question 2

A retail company wants to reduce costs for serving 5,000 personalized recommendation models. Each model is <50MB and receives 10 requests/day. Which deployment strategy is most cost-effective? - A) Deploy each model as a separate Real-Time Endpoint - B) Use SageMaker Multi-Model Endpoint (MME) - C) Use AWS Lambda for each model - D) Use SageMaker Batch Transform

Answer: B) Use SageMaker Multi-Model Endpoint (MME)
Explanation: MME shares infrastructure across models, reducing costs for low-traffic models. Lambda would require 5,000 functions (complex to manage), and Batch Transform is for offline jobs.*


Question 3

A fintech startup needs to deploy a fraud detection model with unpredictable traffic (peaks during market hours). They want to minimize costs while ensuring <100ms latency. Which deployment option is best? - A) SageMaker Real-Time Endpoint with auto-scaling - B) SageMaker Serverless Inference - C) AWS Lambda - D) SageMaker Asynchronous Inference

Answer: A) SageMaker Real-Time Endpoint with auto-scaling
Explanation: Serverless Inference has cold starts (~1-2s), which violate the <100ms requirement. Real-Time Endpoints with auto-scaling handle variable traffic efficiently.*


Last-Minute Cram Sheet

  1. Real-Time Endpoints → Low-latency, persistent, supports A/B testing.
  2. Batch Transform → Offline, large datasets, no persistent endpoint.
  3. Multi-Model Endpoints (MME) → Cost-efficient for thousands of models (S3-based dynamic loading).
  4. Serverless Inference → Pay-per-use, scales to zero, max 6MB payload.
  5. Asynchronous Inference → Large payloads (1GB), long-running (15 min), S3-based results.
  6. Elastic Inference (EI) → GPU acceleration for DL models (cheaper than full GPU).
  7. SageMaker Neo → Compiles models for optimized hardware (e.g., ARM, edge devices).
  8. VPC Endpoints → Required for HIPAA/GDPR compliance (private network).
  9. ⚠️ Serverless Inference has a 200-request concurrency limit (hard cap).
  10. ⚠️ Batch Transform cannot be used for real-time predictions (offline only).


ADVERTISEMENT