Why is the Amazon ECS container instance that I terminated still registered with its cluster?

Last updated: 2022-02-22

I terminated my container instance in Amazon Elastic Container Service (Amazon ECS), but my container instance still appears as a resource in my Amazon ECS cluster. How can I remove this container instance from my cluster?

Short description

If you terminate a RUNNING container instance with a connected Amazon ECS container agent, the agent automatically deregisters the instance from your cluster. However, if you terminate a STOPPED container instance with disconnected agents, the container instance isn't automatically removed from the cluster.

Resolution

Deregister your container instance in the STOPPED state by using the Amazon ECS console or AWS Command Line Interface.

The deregistered container instance will no longer appear as a resource in your Amazon ECS cluster.

To troubleshoot a disconnected ECS agent see Why are my Amazon ECS container instances with Amazon Linux 2 AMIs disconnected?