Last active
August 29, 2015 14:17
-
-
Save wehappyfew/b56e51750929725558a8 to your computer and use it in GitHub Desktop.
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
def list_all_instances(region): | |
# make the connection to AWS with my creds | |
conn = boto.ec2.connect_to_region(region_name = region, | |
aws_access_key_id = aws_access_key_id, | |
aws_secret_access_key = aws_secret_access_key, | |
) | |
reservations = conn.get_all_instances() | |
for r in reservations: | |
for instance in r.instances: | |
print "Reservation:"+str(r.id)+"\n", "Instance:"+str(instance.id), instance.state |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment