ECS cloud deployment ai_generated true

Deregistered ECS task definition but old tasks are still running with old image

ID: cloud/aws-ecs-task-def-deregister-running

Also available as: JSON · Markdown
85%Fix Rate
88%Confidence
3Evidence
2023-01-01First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
any active

Root Cause

Deregistering an ECS task definition does NOT stop running tasks using it. It only prevents new tasks from using that revision. You must force a new deployment to replace running tasks.

generic

Workarounds

  1. 95% success Force new deployment after updating task definition
    aws ecs update-service --cluster my-cluster --service my-service --force-new-deployment
  2. 92% success Update the service to use the new task definition revision
    aws ecs update-service --cluster my-cluster --service my-service --task-definition my-task:NEW_REVISION
  3. 85% success Use deployment circuit breaker to auto-rollback failed deployments
    --deployment-configuration 'deploymentCircuitBreaker={enable=true,rollback=true}'

Dead Ends

Common approaches that don't work:

  1. Deregister old task definition expecting running tasks to stop 92% fail

    Deregistering only marks the revision as INACTIVE. Running tasks continue indefinitely with the old config.

  2. Update the task definition and wait for ECS to auto-deploy 88% fail

    ECS services don't auto-deploy new task definitions. You must explicitly update the service or force a new deployment.