Last active
August 29, 2015 14:16
-
-
Save murarisumit/ce6ae9a52ab05f7be71e to your computer and use it in GitHub Desktop.
Get all ec2 instance
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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