Skip to content
Go to file
Cannot retrieve contributors at this time
51 lines (41 sloc) 1.47 KB


Nightly shutdown tool for AWS EC2 cost-control


When you've got lots of people working on the same AWS capacity, it's easy for somebody to forget to spin down their instances when they're not in use. This tool stops, but does not terminate, any instances in EC2 whose instance-id is not in the whitelist in nightly-shutdown.yml.

How to use it

Run the following commands as root.

  1. Ensure boto is installed.

    yum install -y python-pip
    pip install boto
  2. Clone this repo

    git clone
  3. Put the nightly-shutdown.yml config file in /etc. Don't forget to change mode and ownership to root-only to protect your access and secret keys.

    cp nightly-shutdown/nightly-shutdown.yml /etc
    chown root:root /etc/nightly-shutdown.yml
    chmod 600 /etc/nightly-shutdown.yml
  4. Add your access and secret keys to the config file. White list any instances you'd like to opt-out of the nightly shutdown.

    region: us-east-1
    access_key: eggseggseggseggs
    secret_key: spamspamspamspam
      - i-abcdefgh
      - i-ijklmnop
  5. Copy the utility to cron.daily.

    cp nightly-shutdown/ /etc/cron.daily/nightly-shutdown
    chmod 755 /etc/cron.daily/nightly-shutdown
You can’t perform that action at this time.