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]- Lifecycle order: ApplicationStop → DownloadBundle → BeforeInstall → Install → AfterInstall → ApplicationStart → ValidateService
- CodeDeploy Agent required on EC2 (NOT Lambda/ECS)
- Auto rollback on failure or CloudWatch alarm
- 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.