Created
January 26, 2012 18:55
-
-
Save robbyt/1684363 to your computer and use it in GitHub Desktop.
terminate a list of ec2 servers, passed in from stdin
This file contains 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
#!/usr/bin/env python | |
import boto | |
import sys | |
ec2 = boto.connect_ec2() | |
# cat a file that contains ec2 instance ids into me and | |
# I will eat them up and turn them off | |
for instance in sys.stdin: | |
ec2.start_instances(instance) |
This file contains 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
#!/usr/bin/env python | |
import boto | |
import sys | |
ec2 = boto.connect_ec2() | |
# cat a file that contains ec2 instance ids into me and | |
# I will eat them up and stop (pause) them | |
for instance in sys.stdin: | |
ec2.stop_instances(instance) |
This file contains 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
#!/usr/bin/env python | |
import boto | |
import sys | |
ec2 = boto.connect_ec2() | |
# cat a file that contains ec2 instance ids into me and | |
# I will eat them up and start them | |
for instance in sys.stdin: | |
ec2.terminate_instances(instance) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Setup your boto config before using this:
http://code.google.com/p/boto/wiki/BotoConfig