Copyright (c) 2026 MindMesh Academy. All rights reserved. This content is proprietary and may not be reproduced or distributed without permission.

2.3.3. AWS CodeDeploy for Application Deployment

First Principle: AWS CodeDeploy automates the deployment of application code to various compute services, ensuring consistent, reliable, and versioned releases with minimal downtime.

CodeDeploy automates pushing code to EC2, Lambda, or ECS, configured through appspec.yml which defines lifecycle hooks at each deployment stage.

Two strategies dominate the exam. In-place (EC2 only) stops the app on existing instances, deploys new code, and restarts — simple but causes downtime. Blue/green provisions new instances with the new version, shifts traffic after health checks pass, then terminates old instances — zero downtime with instant rollback.

For Lambda, CodeDeploy manages traffic shifting through aliases: canary (10% → wait → 100%), linear (10% every N minutes), or all-at-once. Lifecycle hooks like BeforeAllowTraffic run validation functions before shifts begin.

The critical exam concept: automatic rollback. If CloudWatch alarms fire during traffic shifting, CodeDeploy reverts automatically — but only if you've configured rollback triggers in the deployment group.

Scenario: You've built your application and now need to deploy it to a fleet of EC2 instances or to a Lambda function. You want to automate this process and minimize downtime during updates.

āš ļø Exam Trap: CodeDeploy for Lambda uses traffic shifting (canary, linear, all-at-once). CodeDeploy for EC2/on-premises uses in-place or blue/green. They use DIFFERENT appspec.yml structures — Lambda uses hooks like BeforeAllowTraffic, EC2 uses hooks like ApplicationStop.

Alvin Varughese
Written byAlvin Varughese•Founder•15 professional certifications