Help improve this page
Want to contribute to this user guide? Scroll to the bottom of this page and select Edit this page on GitHub. Your contributions will help make our user guide better for everyone.
Retrieving Amazon EKS optimized Amazon Linux AMI IDs
You can programmatically retrieve the Amazon Machine Image (AMI) ID for Amazon EKS
optimized AMIs by querying the AWS Systems Manager Parameter Store API. This parameter
eliminates the need for you to manually look up Amazon EKS optimized AMI IDs. For more
information about the Systems Manager Parameter Store API, see GetParameter. The
IAM principal that you use must have the ssm:GetParameter
IAM
permission to retrieve the Amazon EKS optimized AMI metadata.
You can retrieve the image ID of the latest recommended Amazon EKS optimized Amazon Linux AMI with
the following command, which uses the sub-parameter image_id
. Make the
following modifications to the command as needed and then run the modified
command:
-
Replace
with a supported Amazon EKS version.kubernetes-version
-
Replace
with one of the following options. For information about the types of Amazon EC2 instances, see Amazon EC2 instance types.ami-type
-
Use
amazon-linux-2023/x86_64/standard
for Amazon Linux 2023 (AL2023)x86
based instances. -
Use
amazon-linux-2023/arm64/standard
for AL2023 ARM instances. -
Use
amazon-linux-2
for Amazon Linux 2 (AL2)x86
based instances. -
Use
amazon-linux-2-arm64
for AL2 ARM instances, such as AWS Gravitonbased instances. -
Use
amazon-linux-2-gpu
for AL2 GPU accelerated instances.
-
-
Replace
with an Amazon EKS supported AWS Region for which you want the AMI ID.region-code
aws ssm get-parameter --name /aws/service/eks/optimized-ami/
/
kubernetes-version
ami-type
/recommended/image_id \ --region--query "Parameter.Value" --output text
region-code
Here's an example command after placeholder replacements have been made.
aws ssm get-parameter --name /aws/service/eks/optimized-ami/
/
1.30
amazon-linux-2023/x86_64/standard
/recommended/image_id \ --regionus-west-2
--query "Parameter.Value" --output text
An example output is as follows.
ami-1234567890abcdef0