Skip to content

Instantly share code, notes, and snippets.

@robbyt
Created January 26, 2012 18:55
Show Gist options
  • Save robbyt/1684363 to your computer and use it in GitHub Desktop.
Save robbyt/1684363 to your computer and use it in GitHub Desktop.
terminate a list of ec2 servers, passed in from stdin
#!/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)
#!/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)
#!/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)
@robbyt
Copy link
Author

robbyt commented Jan 26, 2012

Setup your boto config before using this:
http://code.google.com/p/boto/wiki/BotoConfig

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment