Created
January 30, 2013 16:44
-
-
Save teknogeek0/4674557 to your computer and use it in GitHub Desktop.
simple boto script to list instances and some information about them.
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 os | |
ACCESS_KEY="<YOUR ACCESS KEY>" | |
SECRET_KEY="<YOUR SECRET KEY>" | |
ec2 = boto.connect_ec2(ACCESS_KEY, SECRET_KEY) | |
instances = ec2.get_all_instances() | |
i = 0 | |
opts = {} | |
print "\nCurrently running instances:" | |
for r in instances: | |
for inst in r.instances: | |
opts[i] = (inst.id, inst.instance_type, inst.private_ip_address , inst.state, inst.launch_time) | |
print "\t%d:" % i + " %s - %s - %s : %s (Running since: %s)" % opts[i] | |
i += 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment