Stop Start AWS Instances Automatically

13 May 2016

In order to save money in AWS you can stop dev instances at night and weekends and start them again in the morning.

I created a wrapper script for AWS cli tools ( that with cronjobs can help you automatically stop aws instances when you don’t use them.

The script is located here:


In order to use the script you need to install and configure aws tools.

Here is a quick how to install and configure aws tools:

sudo pip install awscli
aws configure
aws --profile dev configure

For more information use AWS guide:

How To Use

Here are few examples on how to use the script: -p default -a stop-instances -f Name=tag:daily-stop,Values=true -r us-east-1 -p default -a describe-instances -f Name=tag:daily-stop,Values=true -r us-east-1
for i in dev qa test; do -p $i -a stop-instances -f Name=tag:daily-stop,Values=true -r us-east-1; done
00 09 * * 1-5 /usr/local/bin/ -p default -a start-instances -f Name=tag:daily-start,Values=true -r us-east-1
00 19 * * * /usr/local/bin/ -p default -a stop-instances -f Name=tag:daily-stop,Values=true -r us-east-1

Now you just need to add the right tags to your instances and test it :-)