Skip to content

Instantly share code, notes, and snippets.

@teknogeek0
Created January 30, 2013 16:44
Show Gist options
  • Save teknogeek0/4674557 to your computer and use it in GitHub Desktop.
Save teknogeek0/4674557 to your computer and use it in GitHub Desktop.
simple boto script to list instances and some information about them.
#!/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