Can I pause an ECS service instead of deleting it?
It is enough to set the desired number of tasks for a service to 0. ECS will automatically remove all running tasks.
aws ecs update-service --desired-count 0 --cluster "ecs-my-ClusterName" --service "service-my-ServiceName-117U7OHVC5NJP"
You can accomplish a "pause" by adjusting your service configuration to match your current number of running tasks. For example, if you currently have 3 running tasks in your service, you'd configure the service as below:
This tells the service:
- The number of tasks I want is
[current-count]
- I want you to maintain at least
[current-count]
- I don't want more than
[current-count
These combined effectively halt your service from making any changes.