Last active
June 14, 2017 23:46
-
-
Save marshyski/b8d47557d241298c72e7 to your computer and use it in GitHub Desktop.
Filter instances by a tag and get private IP address
This file contains 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
reservations = ec2.get_all_instances(filters={"tag:Purpose": "Web"}) | |
for res in reservations: | |
for inst in res.instances: | |
if inst.private_ip_address: | |
if inst.state == 'running': | |
print inst.private_ip_address |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment