Stop ECS cluster temporarily

13,604

Solution 1

From EC2 Management Console

  1. Click Auto Scaling Groups from the left menu.
  2. Select the group from the list.
  3. Click edit on the details tab.
  4. Set desired property to '0'.

After clicking save it is all done.

The Auto Scaling Group is smart enough to shut down all instances.

enter image description here

Solution 2

You can use the "Scheduled Actions" feature of Auto Scaling Groups. Starts similar to Kerem Baydoğan's answer From EC2 Management Console:

1 Click Auto Scaling Groups from the left menu.

2 Select the group from the list.

3 Select "Scheduled Actions" from the bar that appeared in the lower middle of the screen.

4 Click on create scheduled action

5 Fill the fields as you see fit and notice that under recurrence there is also a cron option for extra flexibility.

Solution 3

If you have the cluster set to a minimum number of nodes with an asg. If you turn off the nodes the asg will start another node to bring it up to three minimum number of nodes. You must set the asg to zero nodes.. Then turn off the current nodes.

Solution 4

Yes, just stop the EC2 instance directly. When you start the instance again during office hours, the ECS agent will make the services start according to their desired value.

We are doing the same thing and it works for us.

Share:
13,604
Jiew Meng
Author by

Jiew Meng

Web Developer & Computer Science Student Tools of Trade: PHP, Symfony MVC, Doctrine ORM, HTML, CSS, jQuery/JS Looking at Python/Google App Engine, C#/WPF/Entity Framework I hope to develop usable web applications like Wunderlist, SpringPad in the future

Updated on June 30, 2022

Comments

  • Jiew Meng
    Jiew Meng almost 2 years

    I want to stop EC2 instances after office hours to save costs. How can I do the same with ECS instances? Even if I stop all tasks/services, the instance is still there? Do I stop the EC2 instance directly?