Select your cookie preferences

We use essential cookies and similar tools that are necessary to provide our site and services. We use performance cookies to collect anonymous statistics, so we can understand how customers use our site and make improvements. Essential cookies cannot be deactivated, but you can choose “Customize” or “Decline” to decline performance cookies.

If you agree, AWS and approved third parties will also use cookies to provide useful site features, remember your preferences, and display relevant content, including relevant advertising. To accept or decline all non-essential cookies, choose “Accept” or “Decline.” To make more detailed choices, choose “Customize.”

Identify AL2 instances - Amazon Linux 2

Identify AL2 instances

The following information describes how to identify an AL2 instance from another Amazon Linux version or other Linux distribution.

Identify Amazon Linux images

Each image contains a unique /etc/image-id file that identifies it. This file contains the following information about the image:

  • image_name, image_version, image_arch – Values from the build recipe that Amazon used to construct the image.

  • image_stamp – A unique, random hex value generated during image creation.

  • image_date – The UTC time of image creation, in YYYYMMDDhhmmss format.

  • recipe_name, recipe_id – The name and ID of the build recipe Amazon used to construct the image.

Amazon Linux contains an /etc/system-release file that specifies the current release that is installed. This file is updated using yum and is part of the system-release RPM Package Manager (RPM).

Amazon Linux also contains a machine-readable version of /etc/system-release that follows the Common Platform Enumeration (CPE) specification; see /etc/system-release-cpe.

AL2

The following is an example of /etc/image-id for the current version of AL2.

[ec2-user ~]$ cat /etc/image-id image_name="amzn2-ami-hvm" image_version="2" image_arch="x86_64" image_file="amzn2-ami-hvm-2.0.20180810-x86_64.xfs.gpt" image_stamp="8008-2abd" image_date="20180811020321" recipe_name="amzn2 ami" recipe_id="c652686a-2415-9819-65fb-4dee-9792-289d-1e2846bd"

The following is an example of /etc/system-release for the current version of AL2.

[ec2-user ~]$ cat /etc/system-release AL2

The following is an example of /etc/os-release for AL2.

[ec2-user ~]$ cat /etc/os-release NAME="Amazon Linux" VERSION="2" ID="amzn" ID_LIKE="centos rhel fedora" VERSION_ID="2" PRETTY_NAME="Amazon Linux 2" ANSI_COLOR="0;33" CPE_NAME="cpe:2.3:o:amazon:amazon_linux:2" HOME_URL="https://amazonlinux.com/"

Amazon Linux AMI

The following is an example of /etc/image-id for the current Amazon Linux AMI.

[ec2-user ~]$ cat /etc/image-id image_name="amzn-ami-hvm" image_version="2018.03" image_arch="x86_64" image_file="amzn-ami-hvm-2018.03.0.20180811-x86_64.ext4.gpt" image_stamp="cc81-f2f3" image_date="20180811012746" recipe_name="amzn ami" recipe_id="5b283820-dc60-a7ea-d436-39fa-439f-02ea-5c802dbd"

The following is an example of /etc/system-release for the current Amazon Linux AMI.

[ec2-user ~]$ cat /etc/system-release Amazon Linux AMI release 2018.03
PrivacySite termsCookie preferences
© 2025, Amazon Web Services, Inc. or its affiliates. All rights reserved.