Skip to content

Instantly share code, notes, and snippets.

@garnaat
Created December 7, 2011 16:52
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save garnaat/1443559 to your computer and use it in GitHub Desktop.
Save garnaat/1443559 to your computer and use it in GitHub Desktop.
Using get_all_instance_status method in boto
>>> import boto
>>> ec2 = boto.connect_ec2()
>>> stats = ec2.get_all_instance_status()
>>> stats
[InstanceStatus:i-67c81e0c]
>>> stat = stats[0]
>>> stat
InstanceStatus:i-67c81e0c
>>> stat.id
u'i-67c81e0c'
>>> stat.zone
u'us-east-1b'
>>> stat.state_code
16
>>> stat.state_name
u'running'
>>> stat.events
[Event:instance-reboot]
>>> event = stat.events[0]
>>> event.code
u'instance-reboot'
>>> event.description
u'Maintenance software update.'
>>> event.not_before
u'2011-12-11T04:00:00.000Z'
>>> event.not_after
u'2011-12-11T10:00:00.000Z'
>>>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment