Home > Software design >  Is there a proper way to stop ECS tasks and the EC2 instances inside a cluster?
Is there a proper way to stop ECS tasks and the EC2 instances inside a cluster?

Time:12-31

I have 2 ECS clusters in one aws account and planning to shut down 1 of the clusters, the services inside that cluster as well as stop/terminate the ec2 instances in the auto-scaling group. Is there a proper way to achieve this without leaving any traces? I have thought about the following:

  1. Changing number of tasks to 0 in each ECS service (cumbersome as I have 7-8 services)
  2. Setting Desired Count in auto scaling group to 0 (Not sure if this will stop or terminate the EC2 instances)

Any help is appreciated

CodePudding user response:

Whenever you delete ECS cluster it will delete auto-scalling configuration, which also delete instances managed by autoscalling.

https://docs.aws.amazon.com/AmazonECS/latest/developerguide/asg-capacity-providers-delete-capacity-provider.html#:~:text=Option 1: Use the delete command to delete the cluster.

CodePudding user response:

Assuming you are using AWS Cloudformation to setup the ecs cluster, you can delete the cloudformation stack, that will remove all the resources with respect to that CF stack.

Else, see if this helps - deleting via console : https://docs.aws.amazon.com/AmazonECS/latest/developerguide/delete_cluster.html

  • Related