Interview Prep/Real-World Interview/Deployments and releases

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 →

  1. 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"
  1. Add CloudWatch alarms (5xx rate, p99 latency) to the deployment configuration as alarm-based rollback, so a healthy-but-wrong release rolls back too.
  2. Or use CodeDeploy blue/green for ECS with test listeners and alarm-based rollback on traffic shift.
  3. 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.

All Real-World Interview questions Roadmap: Interview readiness

More on Deployments and releases