How to get the Amazon Linux AMI version by AMI id?

5,584

This can be achieved by using describe-images from the EC2 service in the AWS command line tools. You'll have to specify the AMI id for the --image-id argument.

From the docs:

Describes one or more of the images (AMIs, AKIs, and ARIs) available to you. Images available to you include public images, private images that you own, and private images owned by other AWS accounts but for which you have explicit launch permissions.

Note: Deregistered images are included in the returned results for an unspecified interval after deregistration.

Execute the following command:

aws ec2 describe-images \
    --image-id ami-5256b825 \
    --query "Images[*].Description[]" \
    --output text \
    --region eu-west-1

This will be the result:

amzn-ami-pv-2013.09.2.x86_64-ebs

Looking at the output, we can see that the version of the Amazon Linux AMI is 2013.09.2. Looking for this on the Amazon AMI portal, we'll be provided with this page containing the release notes of this version.

Share:
5,584

Related videos on Youtube

Bas Peeters
Author by

Bas Peeters

Updated on September 18, 2022

Comments

  • Bas Peeters
    Bas Peeters over 1 year

    I have an EC2 instance which runs an outdated Amazon Linux AMI (ami-5256b825).

    To upgrade to the most recent version, I first want to know what the differences between 2 images are. I only have the AMI ID (like ami-6e7bd919) and not the version number (like 2014.09).

    I know that ami-6e7bd919 corresponds to 2014.09.1 by looking at the AMI details when I follow the steps in the wizard to launch a new instance, but that's the most I could find out.

    I have found the release notes for each version number, but I don't know how to match them with an AMI ID.

    Does Amazon provide any official documentation in which I can match AMI ID's with their corresponding version numbers?