Finding Ubuntu Images with the AWS SSM Parameter Store

Canonical is the publisher of official Ubuntu images on the Amazon cloud. Canonical is now able to publish information about the latest Ubuntu Images into AWS Systems Manager (SSM) parameter store.

These parameters can be used to determine the latest Ubuntu Amazon Machine Images (AMIs), support dates, and more. These parameters can be used directly in run-instances in EC2 and related services like CloudFormation. Additionally, these parameters are available through the GetParametersByPath, GetParameter, and GetParameters API actions for use in scripts and code.

Overview of Available Parameters

Canonical publishes parameters under the /aws/services/canonical space with the following hierarchies:


Parameter: .../ubuntu/PRODUCT/RELEASE/stable/current/ARCH/VIRT_TYPE/VOL_TYPE/ami-id

Where the fields are as follows:

  • PRODUCT: server or server-minimal
  • RELEASE: focal, 20.04, bionic, 18.04, xenial, or 16.04
  • ARCH: amd64 or arm64
  • VIRT_TYPE: pv or hvm
  • VOL_TYPE: ebs-gp2, ebs-io1, ebs-standard, or instance-store

Release Information

Each release has an end of standard maintenance and end of extended security maintenance date. These are obtained as ISO 8601 encoded date (YYYY-MM-DD) from the following paths:

  • .../ubuntu/server/RELEASE/meta/end-of-standard-maintenance-date
  • .../ubuntu/server/RELEASE/meta/end-of-extended-security-maintenance-date

Publisher ID

The official Canonical publisher ID used to publish images can be found from: .../meta/publisher-id


Latest AMI

The latest amd64 bionic AMI ID can be retrieved from the command line with:

aws ssm get-parameters --names \
        /aws/service/canonical/ubuntu/server/18.04/stable/current/amd64/hvm/ebs-gp2/ami-id \
    --query 'Parameters[0].[Value]' --output text

Run an instance with the latest amd64 focal AMI from the command line with:

aws ec2 run-instances \
    --image-id $(aws ssm get-parameters --names \
        /aws/service/canonical/ubuntu/server/focal/stable/current/amd64/hvm/ebs-gp2/ami-id \
    --query 'Parameters[0].[Value]' --output text) \
    --count 1 --instance-type m5.large

To help locating other AMIs from Canonical, use the Publisher ID:

aws ec2 describe-images --owner $(aws ssm get-parameters \
    --names /aws/service/canonical/meta/publisher-id \
    --query 'Parameters[0].[Value]' \
    --output text)


Users can also reference these parameters in an AWS CloudFormation template:

        Type: 'AWS::SSM::Parameter::Value<AWS::EC2::Image::Id>'
        Default: '/aws/service/canonical/ubuntu/server/bionic/stable/current/amd6/hvm/ebs-gp2/ami-id’

        Type: 'AWS::EC2::Instance'
            ImageId: !Ref LatestAmiId

More information about CloudFormation can be found at:
Integrating AWS CloudFormation with AWS Systems Manager Parameter Store


Finally, users can also leverage AWS SSM in terraform templates:

data "aws_ssm_parameter" "ubuntu-focal" {
    name = "/aws/service/canonical/ubuntu/server/20.04/stable/current/amd64/hvm/ebs-gp2/ami-id"