Interview Prep/AWS/ECS, EKS, Lambda and ECR

Run a one-off migration container on ECS before each deploy. What pattern?

IntermediateScenarioECS, EKS, Lambda and ECR
Answer

Situation read → Run a standalone task as a pipeline step.

What I'd do →

  1. aws ecs run-task --cluster prod --task-definition migrate --launch-type FARGATE --network-configuration ...
  2. Wait: aws ecs wait tasks-stopped --cluster prod --tasks <arn>
  3. Check exit code via describe-tasks
  4. Fail the pipeline on non-zero
  5. Then deploy the service

Why → Separating migration from service start avoids race conditions among replicas.

Interview tip → Use backward-compatible migrations.

aws All AWS questions Roadmap: EKS, ECS & serverless on AWS

More on ECS, EKS, Lambda and ECR