Skip to content

ECS task stuck in DEPROVISIONING with missing VPC Lattice target group, blocking new tasks

0

Hello,

We have an ECS task that has been stuck in DEPROVISIONING for over 24 hours. The task shows an attachment of type VPCLatticeTarget, but the referenced target group (tg-0ff3259d94f24b710) has already been deleted.

Cluster: claythis-ml-cluster-dev

Task ARN: arn:aws:ecs:us-east-1:891515323026:task/claythis-ml-cluster-dev/c2e9b2064f41487c92e47d16736e0683

Last status: DEPROVISIONING

Attachment type: VPCLatticeTarget (status: DETACHING)

Error in task details: "ECS encountered an internal error while managing the VPC Lattice Targets."

When checking the target group via CLI (aws vpc-lattice list-targets), it returns ResourceNotFoundException because the target group no longer exists.

Because of this stuck task, we are unable to free up resources and run new tasks in the cluster. Terminating the underlying EC2 container instance did not resolve the issue.

Could you help us force-remove or clean up this stuck task and its orphaned attachment?

Thank you.

asked a year ago122 views

1 Answer
0

This issue occurs when an ECS task is stuck in the DEPROVISIONING state because it's trying to detach from a VPC Lattice target group that no longer exists.

To troubleshoot and resolve this issue:

  1. First, gather more information about the task using the describe-tasks AWS CLI command:
aws ecs describe-tasks --cluster claythis-ml-cluster-dev --tasks arn:aws:ecs:us-east-1:891515323026:task/claythis-ml-cluster-dev/c2e9b2064f41487c92e47d16736e0683

Check the output for specific error codes, reasons, and stop codes that might provide more insight into why the task is stuck.

  1. Since the VPC Lattice target group has already been deleted, the task is unable to properly deregister from it, causing the "ECS encountered an internal error while managing the VPC Lattice Targets" error.

  2. For immediate resolution, you can try to force-stop the task:

aws ecs stop-task --cluster claythis-ml-cluster-dev --task arn:aws:ecs:us-east-1:891515323026:task/claythis-ml-cluster-dev/c2e9b2064f41487c92e47d16736e0683 --reason "Force stopping stuck task"
  1. If the task remains stuck, contact AWS Support as they may need to manually intervene to clean up the orphaned task.

  2. For future reference, when using VPC Lattice with ECS, ensure that you properly deregister tasks from target groups before deleting the target groups themselves. Amazon ECS automatically registers and deregisters tasks to VPC Lattice target groups, but this process can be disrupted if the target group is deleted while tasks are still registered.

  3. Check your cluster's capacity to ensure you have enough resources to run new tasks once this issue is resolved.
    Sources
    Troubleshoot target deregistration for Amazon ECS tasks | AWS re:Post
    ECS task stuck in the PROVISIONING state | AWS re:Post
    Use Amazon VPC Lattice to connect, observe, and secure your Amazon ECS services - Amazon Elastic Container Service

answered 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.