ladderlore
请求新指南
  • 输入服务名称,例如 S3 或 IAM。

Deployment and Orchestration of ML and AI Workflows

复习清单

03

Deployment and Orchestration of ML and AI Workflows

这个领域的要点,几屏读完,考前再看一遍。

这份复习清单暂时以英文显示。

3.1How models run

  • Bedrock: no servers. SageMaker AI endpoint: GPUs and custom models. Lambda: small and rare.
  • ECS, EKS and EC2: most control, you run the model server. AWS Batch: queued offline jobs.
  • API Gateway plus Lambda in front of a model: authentication, throttling, prompt shaping.
  • SageMaker AI hosting: create_model, create_endpoint_config, create_endpoint, then Runtime invoke_endpoint.
  • Change a live endpoint with a new endpoint config and update_endpoint. Configs cannot be edited.
  • Multi-model endpoint: many models from S3, cold start on the first call. Inference components: per-model copies.

3.1How models run

  • Serial pipeline: 2 to 15 containers in a row. Direct multi-container: pick one with TargetContainerHostname.
  • Orchestrators: Pipelines is ML-native, Step Functions is general, MWAA is Airflow, EventBridge starts them.
  • Real-time

    Fits
    Steady traffic, milliseconds, GPU
    Key limits
    25 MB, 60 seconds
  • Serverless

    Fits
    Spiky traffic, idle gaps, small model
    Key limits
    1 to 6 GB, concurrency up to 200, no GPU
  • Asynchronous

    Fits
    Big or slow requests, scale to zero
    Key limits
    1 GB, 1 hour, result in S3
  • Batch transform

    Fits
    Whole S3 dataset, no endpoint
    Key limits
    Instances stop after the job
Four ways to run inference, and the limits that decide.

1 / 2

  • Real-time

    Fits
    Steady traffic, milliseconds, GPU
    Key limits
    25 MB, 60 seconds
  • Serverless

    Fits
    Spiky traffic, idle gaps, small model
    Key limits
    1 to 6 GB, concurrency up to 200, no GPU

2 / 2

  • Asynchronous

    Fits
    Big or slow requests, scale to zero
    Key limits
    1 GB, 1 hour, result in S3
  • Batch transform

    Fits
    Whole S3 dataset, no endpoint
    Key limits
    Instances stop after the job
Four ways to run inference, and the limits that decide.

3.1Foundation models, agents and RAG

  • Geographic inference profile keeps data in a geography. Global profile is about 10% cheaper.
  • Inference profiles do not support Provisioned Throughput.
  • Large models: tensor parallel degree splits layers across GPUs. Quantization cuts memory.
  • Big models need more VolumeSizeInGB and longer download and health check timeouts.
  • Own model on SageMaker AI: model.tar.gz in S3 plus a container. Bedrock imports Hugging Face safetensors.
  • Agents Classic is closed to new customers (checked November 25, 2026). AgentCore is the successor.
  • AgentCore: Runtime hosts, Gateway makes MCP tools, Identity handles inbound and outbound auth.

3.1Foundation models, agents and RAG

  • MCP connects agents to tools. A2A connects agents to agents. Start with one agent.
  • Hybrid search adds keywords. A reranker reorders chunks and can shrink the prompt, at extra cost.
  • Bedrock on-demand

    You manage
    Nothing
    Pick it when
    Variable traffic, pay per token
  • Provisioned Throughput

    You manage
    Model units
    Pick it when
    Steady load or some customized models
  • Cross-Region profile

    You manage
    Nothing
    Pick it when
    Spikes. Geographic for residency
  • Marketplace or JumpStart

    You manage
    Endpoint instances
    Pick it when
    Model not serverless in Bedrock
  • EC2 or EKS

    You manage
    Everything
    Pick it when
    Own engine, full control
Five ways to run a foundation model.

1 / 2

  • Bedrock on-demand

    You manage
    Nothing
    Pick it when
    Variable traffic, pay per token
  • Provisioned Throughput

    You manage
    Model units
    Pick it when
    Steady load or some customized models
  • Cross-Region profile

    You manage
    Nothing
    Pick it when
    Spikes. Geographic for residency

2 / 2

  • Marketplace or JumpStart

    You manage
    Endpoint instances
    Pick it when
    Model not serverless in Bedrock
  • EC2 or EKS

    You manage
    Everything
    Pick it when
    Own engine, full control
Five ways to run a foundation model.

3.2Capacity, containers and networks

  • Provisioned Throughput: model units, hourly, 0, 1 or 6 months. A customized Bedrock model may need it. An imported one does not.
  • Break-even: hourly price divided by price per token gives tokens per hour.
  • Own container: train and serve commands, /opt/ml/model, port 8080, GET /ping, POST /invocations.
  • ECR pull needs execution role permissions. Turn on image scanning.
  • No GPU on Fargate. ECS and EKS use EC2 GPU nodes. Batch holds queued jobs.
  • VpcConfig for models and jobs. Interface endpoints for runtime, API, ECR and logs. S3 gateway endpoint.
  • Network isolation blocks all outbound calls from the container.

3.2Capacity, containers and networks

  • Target tracking on invocations per instance. LLMs: concurrent requests, updated every 10 seconds.
  • GPU scale to zero needs inference components. Scale-out takes minutes, so buffer requests.
  • Real-time

    Invocations per instance, or concurrent requests
  • Inference component

    Concurrent requests per copy
  • Asynchronous

    Backlog per instance
  • Serverless

    Provisioned concurrency
The scaling signal depends on the endpoint type.

3.2Knowledge bases, agents and infrastructure as code

  • Knowledge base chunking: default 300 tokens, fixed, hierarchical, semantic or none. Fixed after creation.
  • Sync is incremental. Check ingestion jobs for failed documents.
  • Metadata filters need file.ext.metadata.json. OpenSearch Serverless needs the faiss engine.
  • Retrieve returns chunks. RetrieveAndGenerate returns an answer with citations.
  • Query decomposition splits a hard question. Route across knowledge bases in a Lambda pipeline.
  • Agent memory: short-term for the session, long-term across sessions. DynamoDB for custom state.
  • Flows for fixed paths. Step Functions for long processes. Slow tools go through SQS and a worker.

3.2Knowledge bases, agents and infrastructure as code

  • CloudFormation has SageMaker AI and Bedrock resources. Custom Model Import has no CloudFormation support.

3.3Release strategies and CI/CD tools

  • SageMaker AI guardrails: blue/green with all at once, canary or linear, alarms and baking period.
  • Deployment guardrails apply to real-time and asynchronous endpoints, not serverless.
  • CodeDeploy: canary, linear, all-at-once for Lambda and ECS. Hooks run your checks.
  • CodePipeline: stages and actions. Manual approval pauses. CodeConnections links GitHub.
  • Cross-account delivery needs a role and a customer managed KMS key.
  • CodeBuild: buildspec phases, privileged mode for Docker, secrets from Secrets Manager.
  • A VPC build needs a NAT gateway or endpoints.

3.3Release strategies and CI/CD tools

  • CodeCommit availability has changed more than once. Check it before relying on it.
  • Blue/green

    New fleet, shift traffic, alarms, auto rollback
  • Canary or linear

    A slice first, or equal steps
  • Rolling

    Batches, less spare capacity
  • Shadow

    Copy of traffic, answers dropped
  • CodeDeploy

    Canary or linear for Lambda and ECS
Release strategies.

3.3MLOps, prompts and agent releases

  • Pipelines steps: Processing, Training, Tuning, Condition, Register, Callback, Lambda, Fail.
  • Step caching skips unchanged steps. Retry policies handle faults and capacity errors.
  • Tests: unit, data validation, quality gate, regression against production, staging integration and load.
  • Retrain on a schedule, new data or an alarm. Challenger must beat the champion.
  • Avoid retrain loops: minimum interval, limited concurrency, labeled data only.
  • Registry status Approved starts deployment. A resource policy shares groups across accounts.
  • Prompts: use a saved version, not the draft. Variants compare wordings.

3.3MLOps, prompts and agent releases

  • Agents: version, test, then move the alias or endpoint. DEFAULT follows the latest version.
  • Golden prompt sets and judge scores fail the build. A custom model may need Provisioned Throughput.
  • RAG refresh: S3 event, EventBridge, Lambda, ingestion job. A new embeddings model needs a new index.
Monitor alarm
Retrain run
New model version
Status Approved
Deployment starts
An alarm retrains the model. Approval in the registry deploys it.

考试陷阱

  • “Spiky traffic, long idle gaps, small model” → serverless inference, not a real-time endpoint
  • “Large payload, long job, someone waits for the result later” → asynchronous inference, not batch transform
  • “Score a whole S3 dataset, no endpoint left” → batch transform, not real-time
  • “Thousands of rarely used models” → multi-model endpoint, not one endpoint per model
  • “Data must stay in the EU” → geographic inference profile, not a global profile
  • “Fine-tuned Bedrock model, steady high traffic” → Provisioned Throughput. On-demand is for light or variable traffic, and only some models support it

考试陷阱

  • “Fixed steps, known in advance” → Bedrock Flows, not an agent
  • “Container health check fails” → /ping not returning 200 on port 8080
  • “Training in a VPC cannot pull data or the image” → S3 gateway endpoint and ECR endpoints
  • “Wait for a job inside a workflow” → .sync in a Standard workflow, not Express
  • “Approve a model, then deploy” → Model Registry Approved status, not a manual redeploy
  • “Production agent changed after an update” → DEFAULT endpoint follows the latest version