- Newest
- Most votes
- Most comments
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:
- 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 withaws ec2 detach-network-interface --attachment-id [attachment-id], and finally delete withaws ec2 delete-network-interface --network-interface-id [eni-id]
-
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] -
Target group issues: If you deleted a target group before tasks could deregister from it, this could cause the task to remain in DEPROVISIONING.
-
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
Relevant content
asked 2 years ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 2 years ago
