12

This is almost the same question as this one, but for Fargate.

I can't find any way to just stop the cluster or the Fargate service temporarily without having to delete it or changing its task definition.

Tried to stop each task individually but as expected, Fargate provisions a new task right after.

Seems there no option in the AWS console yet - maybe a CLI option exists?

RichVel
  • 7,030
  • 6
  • 32
  • 48
Marco Medrano
  • 2,530
  • 1
  • 21
  • 35

2 Answers2

22

Fargate does not allow you to stop the cluster because there are no underlying EC2 instances that you control to stop. Resources are provisioned in a "serverless" way so you don't have to deal with the underlying resources.

You need to stop the individual tasks but, like you reported, you may encounter that they are replaced after you stop the running tasks that are part of a service. To ensure this doesn't happen update your services to have a "Number of tasks" set to 0. This will keep your service definition up so you don't have to delete them but it will allow you to remove any running tasks.

Hope that helps!

JD D
  • 7,398
  • 2
  • 34
  • 53
2

Found a command in the ecs-cli that does exactly what @jd-d described:

ecs-cli compose --project-name name service down --cluster-config cluster --cluster cluster

Stops the running tasks that belong to the service created with the compose project. This command updates the desired count of the service to 0.

https://docs.aws.amazon.com/AmazonECS/latest/developerguide/cmd-ecs-cli-compose-service-stop.html

It does work! but unfortunately I think it is not a complete answer as seems it only works when using ecs-cli and to manage docker compose.

Marco Medrano
  • 2,530
  • 1
  • 21
  • 35