Created
October 1, 2020 17:09
-
-
Save nmagee/b4eb58591409f1408b5bc980c67f1267 to your computer and use it in GitHub Desktop.
Python3 snippet to iterate out InstanceIds in EC2.
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
import boto3 | |
ec2 = boto3.client('ec2') | |
response = ec2.describe_instances() | |
for r in response['Reservations']: | |
for i in r['Instances']: | |
print(i['InstanceId']) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment