Created
March 6, 2015 06:21
-
-
Save murarisumit/fb8a4162e5fcbb8d9783 to your computer and use it in GitHub Desktop.
Get private IP address of all the instances in aws
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 | |
ec2conn=ec2.connect_to_region('us-east-1') | |
reservations=ec2conn.get_all_instances() | |
for reservation in reservations: | |
#type is <resultset>, a modified version of python LIST | |
resultset=reservation.instances | |
#Get instance object | |
instance=resultset[0] | |
print instance.private_ip_address," (",instance.tags['Name'] , " )" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment