How would you implement automatic rollback in a pipeline that deploys to ECS?
IntermediateScenarioDeployments and releases
Answer
Situation read → ECS has built-in mechanisms; you need to turn them on and connect them to real health signals.
What I'd do →
- Enable the deployment circuit breaker so failed task launches trigger automatic rollback:
aws ecs update-service --cluster prod --service api \
--deployment-configuration "deploymentCircuitBreaker={enable=true,rollback=true},minimumHealthyPercent=100,maximumPercent=200"
- Add CloudWatch alarms (5xx rate, p99 latency) to the deployment configuration as alarm-based rollback, so a healthy-but-wrong release rolls back too.
- Or use CodeDeploy blue/green for ECS with test listeners and alarm-based rollback on traffic shift.
- Make the pipeline wait for the service to stabilise and fail the job if not:
aws ecs wait services-stable --cluster prod --services api
Why → The circuit breaker catches tasks that won't start; alarms catch tasks that start but misbehave.
Interview tip → Distinguish "won't start" from "starts but is broken"; you need a mechanism for both.
More on Deployments and releases
A deploy went out and p99 latency doubled. Walk me through it.IntermediateYou deployed a new version and half the pods are in CrashLoopBackOff. What do you do?BeginnerA release passed every test in staging but broke in production. How do you investigate?IntermediateHow would you design a zero-downtime deployment for a stateless API on Kubernetes?BeginnerEvery deploy causes a short spike of 502 errors from the ALB. Why, and how do you fix it?IntermediateHow would you set up a canary release, and what decides whether it gets promoted?Intermediate