Reputation: 105
I need to list all ami's in a particular region, say us-east-1, using boto3. No filters are needed as of now. I just to need to list all the amis. Any help is appreciated. Thanks in advance.
Upvotes: 0
Views: 2325
Reputation: 269101
The important part of this is to specify self
as the Owner, otherwise you will receive a listing of every public AMI!
import boto3
# Get a list of all AMIs owned by this account_id
client = boto3.client('ec2', region_name='us-east-1')
response = client.describe_images(Owners=['self'])
for ami in response['Images']:
print (ami['ImageId']) # Or whatever you wish to do
See: describe_images()
documentation
Upvotes: 2