AWS Cloud Architecture•Part 5: Security, IAM, Messaging & Enterprise Deployments (51 - 65)
Zero-Downtime Deployments on AWS.
In Simple Words:
- Rolling: CodeDeploy replaces instances incrementally behind the ALB.
- Canary: Directs 10% of traffic to the new version for 10 minutes; automatically rolls back if CloudWatch alarms trigger.
- Blue-Green: Provisions a complete duplicate environment (Green); switches 100% of ALB traffic instantly once health checks pass.
yaml
# AWS CodeDeploy AppSpec for ECS Canary Deployment:
version: 0.0
Resources:
- TargetService:
Type: AWS::ECS::Service
Properties:
TaskDefinition: "arn:aws:ecs:us-east-1:123456789:task-definition/api:2"
LoadBalancerInfo:
ContainerName: "web"
ContainerPort: 80
hooks:
AfterAllowTestTraffic: "arn:aws:lambda:...:function:runSmokeTests"