Skip to main content

AWS CodeDeploy

AWS's managed deployment service for Amazon EC2, on-premises servers, AWS Lambda, and Amazon ECS: in-place and blue/green deployments, canary and linear traffic shifting, AppSpec hooks, automatic rollback, and how it compares with SageMaker AI deployment guardrails.

3 min read · Last reviewed · MLA-C02

Loading your progress

Sign in to bookmark tutorials and track what you have read.

On this page

Already know this topic?

Try the AWS CodeDeploy quiz: 5 questions on AWS CodeDeploy.

What it is

AWS CodeDeploy automates deployments to Amazon EC2 instances, On-premisesIn data centers or offices that you run yourself, rather than in the cloud. Hybrid architectures connect on-premises systems to AWS, for example through AWS Direct Connect or a VPN.Glossary entry servers, AWS Lambda functions, and Amazon ECS services. It controls how a new version replaces the old one, shifts traffic gradually where the platform allows, runs your checks at each step, and rolls back automatically when a deployment fails or an alarm fires.

Choose CodeDeploy when a question asks to release a new version of an application or a Lambda- or ECS-based inference service with canary or linear traffic shifting and automatic rollback (MLA-C02 tasks 3.3.1 and 3.3.2). For models on SageMaker AI endpoints, use SageMaker AI's own deployment guardrails instead.

Concepts and features

  • Deployment types: in-place (update instances in turn; EC2 and on-premises) and Blue/green deploymentReleasing a new version (green) alongside the running one (blue), then moving traffic to green once it is ready. Rolling back is quick: move the traffic back to blue.Glossary entry (create a new set of instances, tasks, or a new function version, then move traffic).
  • Deployment configurations: for EC2, how many instances stay healthy (CodeDeployDefault.OneAtATime is the default, HalfAtATime, AllAtOnce, or custom). For Lambda and ECS, how traffic shifts: canary (for example CodeDeployDefault.LambdaCanary10Percent5Minutes: 10% first, the rest after 5 minutes), linear (for example LambdaLinear10PercentEvery1Minute), or all at once.
  • AppSpec file: what to deploy and lifecycle hooks, such as running a validation Lambda function before and after traffic shifts.
  • Automatic rollback when a deployment fails or a CloudWatch alarm (for example on error rate or LatencyThe time between sending a request and receiving the response, usually measured in milliseconds. Distance and processing add to it; caching and serving users from nearby locations reduce it.Glossary entry) goes into alarm.

Security, resilience, performance, and cost

Security

CodeDeploy uses a service role; EC2 instances need an instance profile and the CodeDeploy agent; revisions in S3 are encrypted; CloudTrail logs deployments.

Resilience

Blue/green keeps the old version ready for fast rollback; alarm-based rollback limits the damage of a bad release.

Performance

Canary and linear shifting limit how many users see a new version at once; choose the step size and interval to match how quickly problems show up.

Cost

No extra charge for deployments to EC2, Lambda, or ECS; on-premises deployments are charged per instance update. You pay for the resources created, such as a second fleet during blue/green.

Monitoring

Deployment state changes go to EventBridge and SNS; CloudWatch alarms drive rollback; the console shows each lifecycle event.

Comparisons

Need Choose
Canary or linear release of a Lambda function or ECS service with rollback AWS CodeDeploy
Canary or linear update of a SageMaker AI endpoint with rollback SageMaker AI deployment guardrails
The whole release workflow with approvals AWS CodePipeline (with a CodeDeploy deploy action)
Create or update infrastructure AWS CloudFormation or the AWS CDK

Reverse mindmap: when the question points here

AWS CodeDeploy: which feature?
  • Traffic shifting
    • 10% of traffic first, the rest later leads to Canary configuration
    • 10% more every minute leads to Linear configuration
    • Lambda or ECS inference service leads to CodeDeploy blue/green
  • Safety
    • Roll back when errors rise leads to Alarm-based automatic rollback
    • Run tests before traffic moves leads to AppSpec lifecycle hook
  • Points elsewhere
    • SageMaker AI endpoint update leads to Deployment guardrails

Key takeaways

  • CodeDeploy deploys to EC2, on-premises, Lambda, and ECS with in-place or blue/green deployments.
  • Lambda and ECS support canary, linear, and all-at-once traffic shifting; EC2 configurations keep a minimum of healthy hosts.
  • AppSpec hooks run checks; CloudWatch alarms trigger automatic rollback.
  • For SageMaker AI endpoints, use deployment guardrails instead.

Sources

Test your knowledge

Loading your quiz progress

Sign in to test your knowledge with 5 questions on AWS CodeDeploy.

Glossary Privacy Install the app

LetMeMaster is an independent educational project and is not affiliated with or endorsed by Amazon Web Services. Practice results do not predict actual exam outcomes.

© 2026 LetMeMaster. All rights reserved. Content may not be copied or redistributed without permission.

Proudly made in Canada

Version 0.0.12

Add LetMeMaster to your Home Screen

  1. Tap the Share button in your browser's toolbar. In Safari it is at the bottom of the screen, or at the top on iPad.
  2. Scroll down and tap Add to Home Screen.
  3. Tap Add. Open LetMeMaster from its icon on your Home Screen.