How do I identify the latest RHEL AMI for my EC2 instance?

Lecture de 3 minute(s)
0

I have Amazon Elastic Compute Cloud (Amazon EC2) instances across different AWS accounts and AWS Regions. I want to make sure that they all use the correct Red Hat Enterprise Linux (RHEL) Amazon Machine Image (AMI).

Short description

All official RHEL AMIs are published under the account ID 309956199498 with the alias amazon.

Note: For AWS GovCloud Regions, Red Hat uses the account ID 219670896067.

Example RHEL AMI name:

RHEL-9.5.0_HVM-20250313-arm64-0-Hourly2-GP3

The preceding example AMI contains the following elements:

  • RHEL is the Operating System (OS) identifier.
  • 9.5.0 is the OS version.
  • HVM is the virtualization type.
  • 20250313 is the release date formatted as year (yyyy), month (mm), and day (dd).
  • arm64 is the architecture.
  • 0 is the automatically incremented build version.
  • Hourly2 is the included RHEL subscription with time-based OS charging.
  • GP3 is the default root volume type (gp3 SSD).
    Note: When you launch a new instance, you can change the volume type.

Note: After the virtualization type, some AMIs might include the GA or _BETA suffixes. For legacy AMIs, the AMIs might not include virtualization type or release date.

Resolution

Note: If you receive errors when you run AWS Command Line Interface (AWS CLI) commands, then see Troubleshooting errors for the AWS CLI. Also, make sure that you're using the most recent AWS CLI version.

To identify all publicly available RHEL AMIs, run the following describe-images AWS CLI command:

aws ec2 describe-images --query 'reverse(sort_by(Images, &CreationDate))[].[Name, ImageId, CreationDate]' --filters 'Name=name,Values=RHEL-*' --owners amazon --output table --region ap-northeast-1

Note: Replace ap-northeast-1 with your Region. The preceding command shows only active AMIs. To also show deprecated AMIs, add the --include-deprecated flag.

The preceding command's output lists all available RHEL AMIs in the Region sorted from latest to earliest.

To identify a specific AMI type, run the following describe-images command:

aws ec2 describe-images --filters 'Name=name,Values=FILTER_EXPRESSION' --owners amazon

Note: Based on your requirements, replace FILTER_EXPRESSION with one of the following values:

  • Use RHEL* to view all RHEL AMIs.
  • Use RHEL-9* to view all RHEL 9 AMIs.
  • Use RHEL-*-x86_64* to view all x86_64 RHEL AMIs.
  • Use RHEL-8.8.0*-2025*-arm64* to view all arm64 RHEL 8.8.0 AMIs that are released in 2025.

To filter, sort, and format your results, you can use the --query and --output flags. To include deprecated AMIs, include the --include-deprecated flag.

Note: It's a best practice to specify the major release number with a filter expression, such as RHEL-9*-x86_64-*. Also, it's a security best practice to use the latest AMI to launch your new EC2 instance.

Related information

Find an AMI that meets the requirements for your EC2 instance

Find shared AMIs to use for EC2 instances

AWS OFFICIEL
AWS OFFICIELA mis à jour il y a 5 jours