Skip to content

Instantly share code, notes, and snippets.

@murarisumit
Last active August 29, 2015 14:16
Show Gist options
  • Save murarisumit/ce6ae9a52ab05f7be71e to your computer and use it in GitHub Desktop.
Save murarisumit/ce6ae9a52ab05f7be71e to your computer and use it in GitHub Desktop.
Get all ec2 instance
from pprint import pprint
from boto import ec2
#You need to give access keys and key secret too..
ec2conn=ec2.connect_to_region('us-west-1')
#A reservation corresponds to a command to start instances. You can see what instances are associated with a reservation:
#Here reservation is like group of instance which can be started and stopped instantly as group
reservations=ec2conn.get_all_instances()
for reservation in reservations:
instance=reservation.instances
print instance
#Referenc: https://cloudpages.wordpress.com/2013/12/18/listing-all-of-your-ec2-instances-using-boto/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment