Delete cloudformation stack failed due to ECS cluster cannot be deleted

0

Hello All,

We use cloudformation to create ECS cluster, but it is always failed when we try to delete cloudformation stack due to ECS cluster cannot be deleted successfully. The error message as below: Resource handler returned message: "Error occurred during operation 'DeleteClusters SDK Error: The Cluster cannot be deleted while Container Instances are active or draining. (Service: AmazonECS; Status Code: 400; Error Code: ClusterContainsContainerInstancesException; Request ID: ecea3cfb-38b7-4d1a-8af5-a11e22999428; Proxy: null)'." (RequestToken: deb1c362-8ee2-7734-28a2-bb306f9f31f3, HandlerErrorCode: GeneralServiceException)

According to error message, the failure reason is "Container Instances are active or draining", so ECS cluster cannot be deleted.

Is there any way to make cloudformation stack can be deleted successfully, for example: force to delete ECS cluster or wait for ECS cluster deleted.

Thanks, Mingtong

1 Answer
0

Hi mingtong,

please consider looking at this guide: https://repost.aws/knowledge-center/ecs-cluster-delete-failure-stack

You may need to delete or stop associated resources. Hope it helps ;)

profile picture
EXPERT
answered a year ago
profile picture
EXPERT
reviewed a year ago
  • Is there any way to make ecs cluster be deleted by cloudformation, not other additional cli?

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.

Guidelines for Answering Questions