Last active
July 23, 2016 05:37
-
-
Save seventhskye/5e5d20f59e951fc62b49ef35458c87eb to your computer and use it in GitHub Desktop.
A script to turn all instances off.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# The TAG_KEY and TAG_VALUE environment variables | |
# can be set before running the script otherwise the | |
# default are used. | |
IDS`aws ec2 describe-instances \ | |
--filter "Name=tag:${TAG_KEY:-ScheduledUptime},Values=${TAG_VALUE:-True}" \ | |
--query 'Reservations[*].Instances[*].[InstanceId]' \ | |
--output text` | |
aws ec2 stop-instances --instance-ids $IDS --output text |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment