I need to get the Details of Images AMI's from AWS Console based on their State: Available.
When I tried it is getting stuck and not printing any line.
Python code 1:
conn = boto3.resource('ec2')
image = conn.describe_images()
print(image) # prints nothing
for img in image:
image_count.append(img)
print("img count ->" + str(len(image_count)))
#prints nothing
Is there any exact keywords for this Image AMI's Please correct me
An important thing to realize about AMIs is that every AMI is provided.
If you only wish to list the AMIs belonging to your own account, use Owners=self
:
import boto3
ec2_client = boto3.client('ec2')
images = ec2_client.describe_images(Owners=['self'])
available = [i['ImageId'] for i in images['Images'] if i['State'] == 'available']