1. Overview

Automated deployment to EC2, on-premises, Lambda, ECS. Uses appspec.yml.

Core

appspec.yml defines deployment. In-Place or Blue/Green for EC2. Canary/Linear/AllAtOnce for Lambda/ECS.

2. EC2 Strategies

3. Lambda/ECS Strategies 4. appspec.yml

version: 0.0
os: linux
files: [{ source: /, destination: /var/www/app }]
hooks:
  BeforeInstall: [scripts/stop.sh]
  AfterInstall: [scripts/deps.sh]
  ApplicationStart: [scripts/start.sh]
  ValidateService: [scripts/health.sh]
  1. Lifecycle order: ApplicationStop → DownloadBundle → BeforeInstall → Install → AfterInstall → ApplicationStart → ValidateService
  2. CodeDeploy Agent required on EC2 (NOT Lambda/ECS)
  3. Auto rollback on failure or CloudWatch alarm
  4. ECS = Blue/Green ONLY via ALB

Exam Tip

CodeDeploy: appspec.yml. In-Place vs Blue/Green (EC2). Canary/Linear (Lambda/ECS). ECS=Blue/Green only. Agent on EC2 only.