Skip to content

Instantly share code, notes, and snippets.

@whaley
Created September 27, 2011 20:23
Show Gist options
  • Save whaley/1246120 to your computer and use it in GitHub Desktop.
Save whaley/1246120 to your computer and use it in GitHub Desktop.
itertools and boto
import itertools
import boto
ec2 = boto.connect_ec2()
chain = itertools.chain.from_iterable
existing_instances = list(chain([res.instances for res in ec2.get_all_instances()]))
print existing_instances #gives you a list of all instances
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment