Design a zero-downtime blue/green for a monolith on EC2 behind an ALB.
AdvancedScenarioEC2, Auto Scaling and Load Balancing
Answer
Situation read → Two environments, one listener, weighted shift with fast rollback.
What I'd do →
- Create blue and green ASGs, each with its own target group
- Deploy the new AMI to green and run smoke tests against a test listener on port 8443
- Shift listener weights 10, 50, 100 percent with alarms on 5xx and latency
- Keep blue running for 30 minutes then scale to zero
- Roll back by flipping weights back:
aws elbv2 modify-listener --listener-arn ... --default-actions ...
Why → Rollback is a weight change, not a redeploy, so recovery takes seconds.
Interview tip → Mention database migrations must be backward compatible for this to work.