Check when an Amazon EC2 AMI was last used - Amazon Elastic Compute Cloud

Check when an Amazon EC2 AMI was last used

Amazon EC2 keeps track of the date and time when your AMI was last used to launch an instance. If you have an AMI that has not been used to launch an instance in a long time, consider whether the AMI is a good candidate for deregistration or deprecation.

Considerations
  • When the AMI is used to launch an instance, there is a 24-hour delay before that usage is reported.

  • You must be the owner of the AMI to get the last launched time.

  • This data about AMI usage is available starting April 2017.

Console
To view the last launched time of an AMI
  1. Open the Amazon EC2 console at https://console.aws.amazon.com/ec2/.

  2. In the left navigation pane, choose AMIs.

  3. From the filter bar, choose Owned by me.

  4. Select the AMI, and then check the Last launched time field (if you selected the check box next to the AMI, it's located on the Details tab). The field shows the date and time when the AMI was last used to launch an instance.

AWS CLI

You can use either the describe-images or describe-image-attribute command to view the last launched time of an AMI that you own.

To view the last launched time of an AMI by using describe-images

Use the describe-images command and specify the ID of the AMI.

aws ec2 describe-images --image-id ami-0123456789example --query "Images[*].LastLaunchedTime[].Value"

The following is example output.

[ "2024-04-02T02:03:18Z" ]

If LastLaunchedTime is not present, verify that you own the AMI.

To view the last launched time of an AMI

Use the describe-image-attribute command and specify --attribute lastLaunchedTime. You must be owner of the AMI to run this command.

aws ec2 describe-image-attribute \ --image-id ami-0123456789example \ --attribute lastLaunchedTime

The following is example output.

{ "ImageId": "ami-1234567890example", "LastLaunchedTime": { "Value": "2022-02-10T02:03:18Z" } }