File: list_instances

package info (click to toggle)
python-boto 1.9b-4
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 1,820 kB
  • ctags: 2,583
  • sloc: python: 16,337; makefile: 106
file content (9 lines) | stat: -rwxr-xr-x 289 bytes parent folder | download
1
2
3
4
5
6
7
8
9
#!/usr/bin/env python
import boto
ec2 = boto.connect_ec2()

print "%-20s %-30s %s" % ("ID", "Groups", "Hostname")
for r in ec2.get_all_instances():
    groups = [g.id for g in r.groups]
    for i in r.instances:
        print "%-20s %-30s %s" % (i.id, ','.join(groups), i.public_dns_name)