-
-
Save ritxos/5e2d7d8fa089968a5ebc898b0e104411 to your computer and use it in GitHub Desktop.
Filter instances by a tag and get private IP address
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
| 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