An ECS service deployment is stuck, tasks start and stop repeatedly. How do you debug?
IntermediateScenarioECS, EKS, Lambda and ECR
Answer
Situation read → The task fails health checks or crashes.
What I'd do →
aws ecs describe-servicesand read the eventsaws ecs describe-tasks --tasks <arn>forstoppedReasonand exit code- Check CloudWatch logs of the container
- Verify the health check path and grace period
healthCheckGracePeriodSeconds - Enable the deployment circuit breaker with rollback
Why → The stopped reason usually names OOM (exit 137) or image pull errors directly.
Interview tip → Exit code 137 equals OOM kill.
More on ECS, EKS, Lambda and ECR
ECS on Fargate or on EC2: how do you choose?BeginnerDeploy a containerized API on ECS behind an ALB. What are the building blocks?BeginnerRoll out a new ECS service version with canary and automatic rollback.IntermediateEKS pods need access to S3 without node-level permissions. How?IntermediateUpgrade an EKS cluster from 1.31 to 1.33 safely.IntermediateDesign node scaling for EKS with mixed Spot and On-Demand and fast scale-up.Advanced