Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in AWS by (19.1k points)

Is there a way to find out Amazon EC2 AMI creation date/time from AWS Console or command line?

Note: I am not looking for instance creation, rather when was a particular AMI created?

1 Answer

0 votes
by (44.4k points)

You can use the describe-images for getting it. Use this:

CreationDate -> (string)

The date and time the image was created and for more information and explanation check out this documentation - https://docs.aws.amazon.com/cli/latest/reference/ec2/describe-images.html.

Sample describe-tags command:

aws ec2 describe-images --filters "Name=tag:Custom,Values=Linux1" --query 'Images[*].{ID:ImageId}'

If not, you can use this python code snippet to get it:

import boto3

ec2 = boto3.resource('ec2', region_name='instance_region_name')

volume = ec2.Volume('vol-id')

print volume.create_time.strftime("%Y-%m-%d %H:%M:%S")

Related questions

0 votes
1 answer

Want to get 50% Hike on your Salary?

Learn how we helped 50,000+ professionals like you !

0 votes
1 answer
0 votes
1 answer
asked Jul 8, 2019 in AWS by Amyra (12.9k points)

Browse Categories

...