Created
April 20, 2011 17:08
-
-
Save drocamor/931976 to your computer and use it in GitHub Desktop.
Greatly simplified view of what EC2 instances are in your account. Faster than running ec2-describe-instances on my laptop (which sucks at running Java).
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
#!/usr/bin/env python | |
import boto | |
# Connect to EC2. Picks up environment variables | |
conn = boto.connect_ec2() | |
# Get a list of my instances | |
reservations = conn.get_all_instances() | |
for reservation in reservations: | |
for instance in reservation.instances: | |
# Print only the stuff I care about | |
print "%s (%s, %s) %s" % (instance.id, instance.state, instance.instance_type, instance.public_dns_name) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment