🌐
Ubuntu Cloud Images
cloud-images.ubuntu.com › locator › ec2
Ubuntu Amazon EC2 AMI Finder
1- Locate the AMI-ID by searching the table below 2- Assuming your ec2 environment is setup, run an instance by “ec2-run-instances ami-xxxxx -O AWS_ACCESS_KEY -W AWS_SECRET_KEY” OR click the ami ID, which will direct you to the AWS console Note:Versions ending in EOL are end-of-life and are provided for reference only
Discussions

Linux kernel source used in Amazon provided Ubuntu AMI?
I'm running a **bare metal** EC2 instance with the Ubuntu AMI provided by Amazon. I have a need to change one of the `CONFIG_XXXX` parameters that can be set when compiling the Linux kernel. Other ... More on repost.aws
🌐 repost.aws
1
0
July 30, 2023
Few questions regarding ubuntu ami id in AWS missing in Amazon EC2 AMI Locator for ubuntu - Stack Overflow
I am fetching the latest available ami id for ubuntu 18.04 LTS available in AWS with the below script export AWS_DEFAULT_REGION=us-east-1 aws ec2 describe-images \ --filters Name=name,Values=ubuntu/ More on stackoverflow.com
🌐 stackoverflow.com
amazon web services - Get latest AMI ID for AWS instance - Stack Overflow
A little-known recent feature is the ability to Query for the latest Amazon Linux AMI IDs using AWS Systems Manager Parameter Store | AWS Compute Blog. More on stackoverflow.com
🌐 stackoverflow.com
amazon ec2 - Is there a list of AMIs for every popular linux distribution and version - Stack Overflow
I need to test a piece of software against every linux distribution/version. I'm going to use amazon AWS Is there a list of AMIs somewhere that I can just copy paste into my script to automate this More on stackoverflow.com
🌐 stackoverflow.com
🌐
Fundamentals-of-devops
fundamentals-of-devops.com › resources › 2025 › 02 › 24 › finding-ami-ids
How to find AMI IDs for Amazon Linux and Ubuntu
February 24, 2025 - Learn the several copy-pasteable recipes for programmatically finding the IDs of the latest Amazon-managed AMIs, such as Amazon Linux and Ubuntu, using tools such as the AWS CLI, OpenTofu, Packer, Ansible, and AWS SSM Parameter Store.
🌐
Amazon Web Services
aws.amazon.com › amazon linux ami
AWS | Amazon Linux AMI
2 weeks ago - The Amazon Linux AMI is a supported and maintained Linux image provided by Amazon Web Services for use on Amazon Elastic Compute Cloud (Amazon EC2). It is designed to provide a stable, secure, and high performance execution environment for applications running on Amazon EC2.
🌐
Michael Bianco
mikebian.co › home › choosing the right ubuntu ami for ec2
Choosing the right Ubuntu AMI for EC2 - Michael Bianco
October 31, 2023 - const ami = aws_ec2.MachineImage.latestAmazonLinux2023({ cpuType: aws_ec2.AmazonLinuxCpuType.ARM_64 }) However, Amazon Linux isn’t always the right choice. It’s not Ubuntu, it’s Fedora (also, Amazon Linux 2 is older than 2023): $ cat ...
🌐
Ubuntu
documentation.ubuntu.com › aws › aws-how-to › instances › find-ubuntu-images
Find Ubuntu images on AWS - Ubuntu on AWS documentation
May 8, 2026 - In these cases, users can verify the Amazon ID and look for aws-marketplace/ubuntu in the ImageLocation field. You can also add Canonical’s OwnerId to allow list: aws ec2 modify-allowed-images --image-owner $OWNER_ID · By running the command ...
Find elsewhere
Top answer
1 of 7
26

A little-known recent feature is the ability to Query for the latest Amazon Linux AMI IDs using AWS Systems Manager Parameter Store | AWS Compute Blog.

The namespace is made up of two parts:

  • Parameter Store Prefix (tree): /aws/service/ami-amazon-linux-latest/
  • AMI name alias: (example) amzn-ami-hvm-x86_64-gp2

These:

aws ec2 describe-images --owners amazon --filters "Name=name,Values=amzn*" --query 'sort_by(Images, &CreationDate)[].Name'

Get-EC2ImageByName -Name amzn* | Sort-Object CreationDate | Select-Object Name

can be changed into:

aws ssm get-parameters --names /aws/service/ami-amazon-linux-latest/amzn2-ami-hvm-x86_64-gp2 --region us-east-1 

Get-SSMParameter -Name /aws/service/ami-amazon-linux-latest/amzn2-ami-hvm-x86_64-gp2 -region us-east-1

Plus, it can be used in a CloudFormation template:

# Use public Systems Manager Parameter
 Parameters :
 LatestAmiId :
 Type : 'AWS::SSM::Parameter::Value<AWS::EC2::Image::Id>'
 Default: ‘/aws/service/ami-amazon-linux-latest/amzn2-ami-hvm-x86_64-gp2’

Resources :
 Instance :
 Type : 'AWS::EC2::Instance'
 Properties :
 ImageId : !Ref LatestAmiId
2 of 7
12

AWS CLI

A way to filter the output and get the only the required attributes is using a combination of filters,queries on the aws describe-images command as below:

aws ec2 describe-images \
--owners 'amazon' \
--filters 'Name=description,Values=Amazon Linux AMI*' \
--query 'sort_by(Images, &CreationDate)[-1].[ImageId]' \
--output 'text'

Command Explanation:

  • owners : For images by amazon, use 'amazon'. To query your own images, use 'self'
  • filters : You can use a list of filters to filter out the instance that you are looking for. I prefer description because I found the name filter missing for some images. Values support wildcards. More on filters
  • query : Query can be used to filter only what is required from the output. You can also sort on fields that would be present in the output. I have sorted on the images and the creation date to get the last created image and filtered the ImageId
  • output : Output can be json or text based on the way you plan to consume it.

Using Python

You can do the same using the below python script:

import boto3
from operator import itemgetter

client = boto3.client('ec2')
response = client.describe_images(
    Filters=[
        {
            'Name': 'description',
            'Values': [
                'Amazon Linux AMI*',
            ]
        },
    ],
    Owners=[
        'amazon'
    ]
)
# Sort on Creation date Desc
image_details = sorted(response['Images'],key=itemgetter('CreationDate'),reverse=True)
ami_id = image_details[0]['ImageId']

Update:

You can use fine-grain filters to get a quicker response. The filters mentioned in @Jack's answer work.

filters = [ {
    'Name': 'name',
    'Values': ['amzn-ami-hvm-*']
},{
    'Name': 'description',
    'Values': ['Amazon Linux AMI*']
},{
    'Name': 'architecture',
    'Values': ['x86_64']
},{
    'Name': 'owner-alias',
    'Values': ['amazon']
},{
    'Name': 'owner-id',
    'Values': ['137112412989']
},{
    'Name': 'state',
    'Values': ['available']
},{
    'Name': 'root-device-type',
    'Values': ['ebs']
},{
    'Name': 'virtualization-type',
    'Values': ['hvm']
},{
    'Name': 'hypervisor',
    'Values': ['xen']
},{
    'Name': 'image-type',
    'Values': ['machine']
} ]

# Use above filters 
response = client.describe_images(
  Filters=filters,
  Owners=[
      'amazon'
  ]
)
Top answer
1 of 8
27

The success of Ubuntu as a platform and Ubuntu's commitment to refreshing AMIs means that there are literally thousands of of images on Amazon EC2 with "ubuntu"in their name. That, combined with and the lack of Ubuntu on the "Quick Start" menu makes selecting the right AMI a non-trivial task.

Some General Ubuntu Information

You already may be aware of these items, but I want to point them out for those who are just getting started with Ubuntu or EC2.

  • Ubuntu releases every 6 months. Each release has a version number and a codename. The most important thing to note here is that every 2 years a LTS (Long Term Support) release is made. If you want stability and support for 5 years, select an LTS release. If you want the newest packages, select the most recent release. See the wikipedia entry for more information.
  • At the time of this writing, there are 5 "regions" in Amazon EC2. Each region represents a geographical location. Each region has its own AMI ids. Inside each region there are 2 architectures (x86_64, i386) and 2 "root store" types (EBS or instance). That means that for each build Ubuntu releases, we generate 20 ami ids.

Easiest: Find AMIs From Your Web Browser

You can choose your interface for selecting images. Go to either:

  • https://cloud-images.ubuntu.com/locator/

    At the bottom of this page, you can select the region, release, arch or root-store. You're only shown the most recent releases here. When you've made your selection, you can copy and paste the ami number, or just click on it to go right to the EC2 console launch page for that AMI.

or

  • https://cloud-images.ubuntu.com/server/releases/
    • Select Your release by number or code-name
    • Select 'release/': We keep historical builds around for debugging, but the 'release/' directory will always be the latest.
    • Select your AMI from the table and click to launch in the console or copy and paste a command line.

Search through the Amazon EC2 Console

The EC2 Console is a graphical way to sort through AMIs and select one to launch. To Launch an Official Ubuntu Image here, follow the steps below.

  • Select the region you want in the top left, under 'Navigation' Example: "Us East (Virginia)"

  • Click "AMIs" Do not click "Launch Instance" [see note below]

  • for 'Viewing', select "All Images"

  • Limit the results to Ubuntu Stable Release images by typing ubuntu-images/

    You should expand the 'AMI Name' field as wide as possible (maybe shrink the others).

  • Limit the results to a specific release by appending '.*'.

    For example: ubuntu-images/.*10.04

  • Limit the results to a given arch by appending '.*i386' or '.*amd64'

    Note: If you want to run a m1.small or c1.medium, you need 'i386'. If you want to run a t1.micro, you will need to select an 'ebs' image.

  • Sort your results by AMI Name and make selection

    By sorting by AMI name, you can more easily see the newest AMI for a given set. Each AMI ends with a number in the format YYYYMMDD (year,month,day). You want the most recent one.

  • Verify the Owner is 099720109477!

    Any user can register an AMI under any name. Nothing prevents a malicious user from registering an AMI that would match the search above. So, in order to be safe, you need to verify that the owner of the ami is '099720109477'. Ownership verification

  • If "Owner" is not a column for you, click "Show/Hide" at the top right and select "Owner" to be shown.

  • Click on the AMI name, then Click 'Launch'

Notes

  • Web Console 'Launch Instance' dialog: I saw no way in the 'Launch Instance' dialog to see the Owner ID. Because if this, I suggest not using that dialog to find "Community AMIs". There is simply no way you can reliably know who the owner of the image is from within the console. For advanced users, I will blog sometime soon on a way to find AMIs programmatically [Hint].

Source 1: ubuntu-smoser.blogspot.com

Source 2: ubuntu.com

2 of 8
12

New and improved version.

# needed as json list returned by ubuntu site is mal-formed
remove_last_comma() { sed '
        $x;$G;/\(.*\),/!H;//!{$!d
    };  $!x;$s//\1/;s/^\n//'
}

curl -s "https://cloud-images.ubuntu.com/locator/ec2/releasesTable" \
    | remove_last_comma \
    | jq -c '.aaData[] | select(contains(["16.04", "us-west-2", "hvm:ebs"]))' \
    | grep -o 'ami-[a-z0-9]\+' | head -1

Basically grabs raw data used for ubuntu's ami finding page, and uses jq to parse out the row I want then a grep to pull out the value. Much faster than the old version.


-- original version

Here's another example. I just wrote this to fetch the latest trusty AMI id. It uses the aws cli tool to query the API, using the fact that the names sort in date order to get the latest.

name=$(\
    aws --region us-west-2 ec2 describe-images --owners 099720109477 \
        --filters Name=root-device-type,Values=ebs \
            Name=architecture,Values=x86_64 \
            Name=name,Values='*hvm-ssd/ubuntu-trusty-14.04*' \
    | awk -F ': ' '/"Name"/ { print $2 | "sort" }' \
    | tr -d '",' | tail -1)

ami_id=$(\
    aws --region us-west-2 ec2 describe-images --owners 099720109477 \
        --filters Name=name,Values="$name" \
    | awk -F ': ' '/"ImageId"/ { print $2 }' | tr -d '",')

It works in 2 parts. The first part gets all the AMIs for ubuntu trusty that meet the various criterion (ebs, x86_64, and the name pattern). It pulls out the Name and sorts by it. The names are formatted so that sorting them sorts by date so the last one will be the newest one. This name is then assigned to the 'name' variable.

The second part uses that name to request the AMI ID for the AMI with that name. It parses out just the id and assigns it to 'ami_id'.

🌐
GitHub
gist.github.com › vancluever › 7676b4dafa97826ef0e9
Find the most recent Ubuntu AMI using aws-cli (or any other AMI for that matter) · GitHub
With Image Name and AMI ID together, aws ec2 describe-images --filters "Name=name,Values=ubuntu*" --query "sort_by(Images, &CreationDate)[].[Name, ImageId]" BTW, Thanks to All of you for posting your comments on this. It helped me! ... You can also do all of the sorting and filtering in the CLI itself, which should be portable between Windows / Mac / Linux: $ aws ec2 describe-images --filters "Name=name,Values=amazon-eks-node-1.11*" --query 'reverse(sort_by(Images, &CreationDate))[0]' { "Architecture": "x86_64", "CreationDate": "2019-06-15T06:31:01.000Z", "ImageId": "ami-053e2ac42d872cc20", "I
🌐
Medium
gauravguptacloud.medium.com › find-a-linux-ami-aws-c15faf59216f
Find a Linux AMI- AWS. Before you can launch an instance, you… | by Gaurav Gupta | Medium
September 23, 2019 - aws ec2 describe-images — owners amazon — filters ‘Name=name,Values=amzn-ami-hvm-????.??.?.????????-x86_64-gp2’ ‘Name=state,Values=available’ — output json | jq -r ‘.Images | sort_by(.CreationDate) | last(.[]).ImageId’ ... aws ec2 describe-images — owners 099720109477 — filters ‘Name=name,Values=ubuntu/images/hvm-ssd/ubuntu-xenial-16.04-amd64-server-????????’ ‘Name=state,Values=available’ — output json | jq -r ‘.Images | sort_by(.CreationDate) | last(.[]).ImageId’
🌐
AWS
aws.amazon.com › blogs › compute › using-system-manager-parameter-as-an-alias-for-ami-id
Using System Manager Parameter as an alias for AMI ID | Amazon Web Services
March 12, 2025 - This post was authored by Brian Terry, Senior Partner Solutions Architect, Cloud Management Tools Technical Lead. In this post, I demonstrate how you can use AWS Systems Manager Parameter Store’s, native parameter support for Amazon Machine Image (AMI) IDs while launching Amazon EC2 instances.
🌐
Stack Overflow
stackoverflow.com › questions › 79216425 › how-to-find-the-right-ami-id-for-amazon-linux-2
How to find the right ami id for amazon linux 2 - Stack Overflow
I have only found it so far by chat gpt, but not by googling or by using the proposed way from aws: aws ec2 describe-images --owners amazon nor is the AMI shown in the EC2 console the correct one....
🌐
AWS
docs.aws.amazon.com › amazon linux › user guide › identifying amazon linux instances and versions › amazon linux specific
Amazon Linux Specific - Amazon Linux 2023
There are some files that are specific to Amazon Linux that can be used for identifying Amazon Linux and what version it is. New code should use the standard in order to be cross-distribution compatible. Use of any Amazon Linux specific files is discouraged.
🌐
Michaelheap
michaelheap.com › aws-find-ami-owner-id
Find AWS EC2 AMI owner ID | michaelheap.com
September 2, 2021 - I found the AMI ID on Ubuntu Cloud Images, but it didn’t return the owner ID.
🌐
AWS
docs.aws.amazon.com › amazon linux › user guide › using al2023 on aws › al2023 on amazon ec2
AL2023 on Amazon EC2 - Amazon Linux 2023
4 weeks ago - Start using AL2023 by setting up a new instance in the AWS CLI using the CloudFormation AMI ID parameter.