When I want to launch an instance of Ubuntu on EC2, how do I find the right one? There are thousands of public images that have "Ubuntu" in their name. I am only interested in running the Official Ubuntu images. How do I now which AMI is the right one?


8 Answers 8


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.


  • 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'.

  • 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'


  • 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

  • 1
    Could you please precise the difference between hvm-instance and hvm-ssd ? I'm afraid "instance" means "paravirtual", but am not sure, and can't find info about it. Also, it can be useful to note that https://cloud-images.ubuntu.com/locator/ offer filters... at the bottom of the page
    – Balmipour
    Commented Sep 28, 2016 at 17:16

New and improved version.

# needed as json list returned by ubuntu site is mal-formed
remove_last_comma() { sed '
    };  $!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.

    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)

    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'.

  • Can you please explain what this does?
    – Kaz Wolfe
    Commented Oct 8, 2014 at 8:03
  • Added the explanation to the answer. Commented Dec 23, 2014 at 5:23
  • 4
    This should accomplish something similar, but using a JMESPath query expression: 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*' --query 'sort_by(Images, &Name)[-1].ImageId'
    – dnlbrky
    Commented Apr 19, 2015 at 19:00

using ruby aws-sdk, you can programatically discover the latest Ubuntu AMI like this

    ec2 = AWS::EC2.new

    root_device_type = "ebs"
    ami_owner = '099720109477'
    ami_name = "*ubuntu/images/#{root_device_type}/ubuntu-precise-12.04*"  # hardcoded to ubuntu 12.04. You can apply your own criteria here.

    AWS.memoize do
      linux_ami = ec2.images.with_owner(ami_owner).
        filter("root-device-type", root_device_type).
        filter("architecture", "x86_64").        # use 'i386' for 32 bit and 'x86_64' for 64 bit
        filter("name", ami_name)
        # this only makes one request due to memoization
        return linux_ami.to_a.sort_by(&:name).last
        abort red "Error discovering latest AMI. Terminating."

You can use https://cloud-images.ubuntu.com/locator/ec2/ which provide a comprehensive comparison based on version, release date etc.

Search for the version, region you want and sort based on release date to get the latest version.


I thought it would be useful to demonstrate how to do this using with Ansible by using the ec2_ami_find module.

At the time of writing (2017-06-07) in the ap-southeast-2 region AWS will suggest these Ubuntu LTS images if you start an EC2 instance manually from the console:

  • Ubuntu Server 16.04 LTS (HVM), SSD Volume Type - ami-96666ff5
  • Ubuntu Server 14.04 LTS (HVM), SSD Volume Type - ami-807876e3

This is in line with their recommendations to use HVM virtualization and EBS backed SSD Volumes.

For the best performance, we recommend that you use current generation instance types and HVM AMIs when you launch your instances.

To get the same AMIs that AWS recommend you can use the following tasks:

- name: Find the most recent xenial AMI
    aws_access_key: "{{ vault_aws_access_key }}"
    aws_secret_key: "{{ vault_aws_secret_key }}"
    region: "{{ config_region }}"
    name: "ubuntu/images/hvm-ssd/ubuntu-xenial-16.04-amd64-server-*"
    owner: 099720109477 # canonical ownerid
    virtualization_type: hvm
    sort: name
    sort_order: descending
    sort_end: 2
  register: ami_find_xenial

- name: Newest Xenial AMI
    msg: "{{ ami_find_xenial.results[0].ami_id }}"

- name: AWS recommend Xenial AMI
    msg: "{{ ami_find_xenial.results[1].ami_id }}"

- name: Find the most recent trusty AMI
    aws_access_key: "{{ vault_aws_access_key }}"
    aws_secret_key: "{{ vault_aws_secret_key }}"
    region: "{{ config_region }}"
    name: "ubuntu/images/hvm-ssd/ubuntu-trusty-14.04-amd64-server-*"
    owner: 099720109477 # canonical ownerid
    virtualization_type: hvm
    architecture: x86_64
    sort: name
    sort_order: descending
    sort_end: 3
  register: ami_find_trusty

- name: Newest Trusty AMI
    msg: "{{ ami_find_trusty.results[0].ami_id }}"

- name: AWS recommend Trusty AMI
    msg: "{{ ami_find_trusty.results[2].ami_id }}"

Which gives the following output:

TASK [Load secrets from Vault] *****************************************************************************************************************************************************************************
ok: [localhost]

TASK [Find the most recent xenial AMI] *********************************************************************************************************************************************************************
ok: [localhost]

TASK [Newest Xenial AMI] ***********************************************************************************************************************************************************************************
ok: [localhost] => {
    "changed": false, 
    "msg": "ami-1e01147d"

TASK [AWS recommended Xenial AMI] **************************************************************************************************************************************************************************
ok: [localhost] => {
    "changed": false, 
    "msg": "ami-96666ff5"

TASK [Find the most recent trusty AMI] *********************************************************************************************************************************************************************
ok: [localhost]

TASK [Newest Trusty AMI] ***********************************************************************************************************************************************************************************
ok: [localhost] => {
    "changed": false, 
    "msg": "ami-993e2bfa"

TASK [AWS recommended Trusty AMI] **************************************************************************************************************************************************************************
ok: [localhost] => {
    "changed": false, 
    "msg": "ami-807876e3"

If you compare the AMI ids returned by the playbook you can see AWS do not recommend the latest available image but rather the second or third latest. I don't know what criteria/heuristic they are using here.


There is a comprehensive list of available Official AMIs on the Ubuntu Cloud Portal. You an find additional resources regarding Canonical's Official EC2 AMI releases in the Ubuntu Help: EC2 Starts Guide and a raw directory of all the AMIs released by Canonical in Ubuntu EC2 Images


Simple and fast AWS CLI answer

aws ec2 describe-images \
  --filters "Name=name,Values=ubuntu/*" \ 
  "Name=architecture,Values=x86_64" \
  --owners 099720109477 \
  --max-results 5

This lists all Ubuntu images in the current region, from the official Ubuntu company. The max-results filter means the query doesn't take a couple minutes to download the ocean.

As a human, you can manually inspect the results to find the ImageId that makes sense for your application.

The above query only returns two matches -- it's very easy and fast to get the image ID and move on!


This is an old thread but it still appears quite often.

There is a more detailed and official page here to get the latest image of all the Ubuntu versions on AWS: https://canonical-aws.readthedocs-hosted.com/en/latest/aws-how-to/instances/find-ubuntu-images/

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .