Skip to content

ECS task stuck Deprovisioning for over 2 years

0

We have an ECS task that has been stuck in Deprovisioning since June 2023. How can we get this task removed?

asked a year ago257 views

1 Answer
0

When an ECS task gets stuck in the DEPROVISIONING state for an extended period, it's typically because Amazon ECS is unable to complete the cleanup steps after the task stops but before it transitions to the STOPPED state.

For tasks stuck in DEPROVISIONING, there are a few common causes and solutions:

  1. Attached resources that can't be cleaned up: The task may have EBS volumes or ENIs (Elastic Network Interfaces) still attached to it. You can try:
  • Detaching the volume using: aws ec2 detach-volume --volume-id [volume-id]
  • Detaching and deleting the ENI: First get the attachment ID with aws ec2 describe-network-interfaces --network-interface-ids [eni-id], then detach with aws ec2 detach-network-interface --attachment-id [attachment-id], and finally delete with aws ec2 delete-network-interface --network-interface-id [eni-id]
  1. Service-linked roles: You may have deleted service-linked roles associated with the service before the task was terminated. Check if a service-linked role is associated with your service using: aws ecs describe-services --cluster [cluster-name] --services [service-name]

  2. Target group issues: If you deleted a target group before tasks could deregister from it, this could cause the task to remain in DEPROVISIONING.

  3. Recreate the cluster: In some cases, recreating an ECS cluster with the same name has helped "unstick" tasks that were in deprovisioning state.

If these steps don't resolve the issue, you should contact AWS Support, as they can help clean up resources that have been stuck for such an extended period. Given that your task has been stuck for over two years, this might be the most efficient approach.
Sources
Had ECS task with EBS volume stuck in deprovisioning. Was able to "kill" the ECS task, but EBS volume & ENI won't shut down | AWS re:Post
Amazon ECS task stuck in a lifecycle state | AWS re:Post

answered a year ago

EXPERT

reviewed a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.