🌐
AWS
docs.aws.amazon.com › amazon linux › user guide › using al2023 on aws › al2023 on amazon ec2
AL2023 on Amazon EC2 - Amazon Linux 2023
1 month ago - Start using AL2023 by setting up a new instance in the AWS CLI using the CloudFormation AMI ID parameter.
🌐
GitHub
github.com › amazonlinux › amazon-linux-2023
GitHub - amazonlinux/amazon-linux-2023: Amazon Linux 2023 · GitHub
To launch the latest Amazon Linux 2023 AMI using CloudFormation, you can use the following template: Parameters: LatestAmiId: Type: 'AWS::SSM::Parameter::Value<AWS::EC2::Image::Id>' Default: '/aws/service/ami-amazon-linux-latest/al2023-ami-kernel-6.1-arm64' Resources: Instance: Type: 'AWS::EC2::Instance' Properties: ImageId: !Ref LatestAmiId
Starred by 616 users
Forked by 48 users
Languages   HTML
Discussions

amazon web services - Get latest AMI ID for AWS instance - Stack Overflow
I wanted to fetch the latest ami id for AWS Linux machine while creating an ec2 instance for an autoscaling architecture. I was trying the aws cli to get the images types, but it would print out a... More on stackoverflow.com
🌐 stackoverflow.com
NEW Amazon Linux AMI - IMDSv2 as default
Hello Team, In New Amazon Linux AMI AMI ID ami-02f3f602d23f1659d (al2023-ami-2023.0.20230315.0-kernel-6.1-x86_64), which they launched on 15th March,2023 the Instance Metadata Service comes with v... More on repost.aws
🌐 repost.aws
1
0
March 27, 2023
bug: Amazon Linux 2023 EC2 Image not tagged to all the correct AMI IDs
The AMI ID that the Amazon Linux 2023 image is tagged with should also be what's stored in the SSM Parameter for /aws/service/ami-amazon-linux-latest/al2023-ami-kernel-6.1-x86_64, or an image matching that should also be downloaded and tagged correctly. More on github.com
🌐 github.com
2
May 3, 2024
Best way to find AMI ID of Amazon Linux 2 for each region for a CloudFormation map?
https://aws.amazon.com/blogs/compute/query-for-the-latest-amazon-linux-ami-ids-using-aws-systems-manager-parameter-store/ More on reddit.com
🌐 r/aws
5
1
September 18, 2018
🌐
AWS
aws.amazon.com › blogs › containers › amazon-eks-optimized-amazon-linux-2023-amis-now-available
Amazon EKS-Optimized Amazon Linux 2023 AMIs Now Available | Amazon Web Services
April 1, 2024 - The Amazon EKS-optimized Amazon Linux 2023 AMI is built on top of Amazon Linux 2023, and is configured to serve as the base image for Amazon EKS nodes. The AMI is configured to work with Amazon EKS and it includes the following components: ... To retrieve the AMI ID, you will need to query ...
🌐
Amazon Web Services
aws.amazon.com › amazon linux ami
AWS | Amazon Linux AMI
2 weeks ago - Customers are encouraged to upgrade their applications to use Amazon Linux 2023, which includes long term support through 2028. ... 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).
🌐
AWS
docs.aws.amazon.com › amazon eks › user guide › manage compute resources by using nodes › create nodes with pre-built optimized images › create nodes with optimized amazon linux amis › retrieve recommended amazon linux ami ids
Retrieve recommended Amazon Linux AMI IDs - Amazon EKS
You can retrieve the image ID of ... image_id. Make the following modifications to the command as needed and then run the modified command: Replace <kubernetes-version> with an Amazon EKS supported version. Replace ami-type with one of the following options. For information about the types of Amazon EC2 instances, see Amazon EC2 instance types. Use amazon-linux-2023/x86_64/standard ...
🌐
AWS
docs.aws.amazon.com › amazon linux › user guide › using al2023 on aws › al2023 on amazon ec2 › comparing al2023 standard and minimal amis
Comparing AL2023 standard and minimal AMIs - Amazon Linux 2023
May 22, 2026 - Use a standard AMI (default) to get started quickly and have all the major AMI features. Use a minimal AMI to choose only the software that you need for less disk space utilization.
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'
  ]
)
Find elsewhere
🌐
AWS
aws.amazon.com › blogs › aws › amazon-linux-2023-a-cloud-optimized-linux-distribution-with-long-term-support
Amazon Linux 2023, a Cloud-Optimized Linux Distribution with Long-Term Support | Amazon Web Services
November 17, 2025 - You can use the EC2 run-instances ... Amazon Linux 2023 AMIs that we provide. We support two machine architectures (x86_64 and Arm) and two sizes (standard and minimal). Minimal AMIs contain the most basic tools and utilities to start the OS. The standard version comes with the most commonly used applications and tools installed. To retrieve the latest AMI ID for a specific ...
🌐
AWS
docs.aws.amazon.com › amazon ecs › developer guide › amazon ecs clusters › amazon ecs capacity providers for ec2 workloads › amazon ec2 container instances for amazon ecs › amazon ecs-optimized linux amis › retrieving amazon ecs-optimized linux ami metadata
Retrieving Amazon ECS-optimized Linux AMI metadata - Amazon Elastic Container Service
For an example of how to use the Systems Manager parameter, see Create an Amazon ECS cluster with the Amazon ECS-optimized Amazon Linux 2023 AMI in the AWS CloudFormation User Guide. The AMI ID, image name, operating system, container agent version, source image name, and runtime version for ...
🌐
AWS re:Post
repost.aws › questions › QUkI6n7F9gRzG_eBjZ-00xew › new-amazon-linux-ami-imdsv2-as-default
NEW Amazon Linux AMI - IMDSv2 as default | AWS re:Post
March 27, 2023 - Hello Team, In New Amazon Linux AMI AMI ID ami-02f3f602d23f1659d (al2023-ami-2023.0.20230315.0-kernel-6.1-x86_64), which they launched on 15th March,2023 the Instance Metadata Service comes with v...
🌐
GitHub
github.com › localstack › localstack › issues › 10764
bug: Amazon Linux 2023 EC2 Image not tagged to all the correct AMI IDs · Issue #10764 · localstack/localstack
May 3, 2024 - When spinning up a EC2 pointing at MachineImage.latestAmazonLinux2023(), LocalStack will clone the Amazon Linux 2023 image and tag it with the ami-024f768332f0 AMI, while the stack resolves the desired AMI ID to ami-0e58172bedd62916b causing ...
Author   localstack
🌐
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 - For example, to look up the ID of the most recent Amazon Linux 2023 AMI in us-east-2, authenticate to AWS, and then run the following command:
🌐
AWS Marketplace
aws.amazon.com › marketplace › pp › prodview-ia3l7n7czmqsk
AWS Marketplace: Amazon Linux 2023 AMI (amazon linux 2023) | Support by SupportedImages
Amazon Linux 2023 AMI is a secure, stable, and high-performance Linux server optimized for the Amazon EC2 environment. It provides integration with AWS services, ensuring seamless access to cloud-native tools and libraries. Designed for developers and system administrators, Amazon Linux 2023 supports multiple programming languages and frameworks, making it ideal ...
🌐
AWS
docs.aws.amazon.com › deep learning ami › developer guide › deep learning amis release notes › aws deep learning arm64 base gpu ami (amazon linux 2023)
AWS Deep Learning ARM64 Base GPU AMI (Amazon Linux 2023) - AWS Deep Learning AMIs
export SSM_PARAMETER=base-oss-nvidia-driver-gpu-amazon-linux-2023/latest/ami-id && \ aws ssm get-parameter --region us-east-1 \ --name /aws/service/deeplearning/ami/arm64/$SSM_PARAMETER \ --query "Parameter.Value" \ --output text
🌐
GitHub
gist.github.com › drsuess › c8a896a31b606a1c46b8fa5f3d0918c9
A list of AMI IDs for Amazon Linux 2023 EC2 AMIs. Useful if you are working with Mappings and RegionMaps in CloudFormation templates · GitHub
A list of AMI IDs for Amazon Linux 2023 EC2 AMIs. Useful if you are working with Mappings and RegionMaps in CloudFormation templates - Updated Amazon Linux 2023 AMI ID List.md
🌐
AWS
aws.amazon.com › blogs › containers › amazon-eks-optimized-amazon-linux-2023-accelerated-amis-now-available
Amazon EKS optimized Amazon Linux 2023 accelerated AMIs now available | Amazon Web Services
October 22, 2024 - The recommended AMI ID can be retrieved from an Amazon EKS provided AWS Systems Manager parameter using the Region and Kubernetes version of the cluster that the instances will join. At launch, the accelerated AL2023 AMI is available in two variants: NVIDIA x86 and Neuron x86. AL2023_x86_64_NEURON: 'amazon-linux-2023...
🌐
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.