View a markdown version of this page

Amazon Linux-specific identification - Amazon Linux 2027
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

Amazon Linux-specific identification

Some files are specific to Amazon Linux and can identify Amazon Linux and its version. For new code, use the /etc/os-release standard for cross-distribution compatibility, and avoid the Amazon Linux-specific files.

System release file

Amazon Linux contains an /etc/system-release file that specifies the current release that is installed. This file is updated through package managers, and on Amazon Linux it is part of the system-release package. Although some other distributions like Fedora also have this file, it is not present in Debian-based distributions like Ubuntu.

Note

The /etc/system-release file contains a human-readable string and should not be used programmatically to identify an OS or release. Use the machine-readable fields in /etc/os-release (or /usr/lib/os-release if /etc/os-release does not exist) instead.

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

On AL2027, the /etc/system-release and /etc/system-release-cpe files are symbolic links to files under /usr/lib. The /etc/amazon-linux-release and /etc/amazon-linux-release-cpe links point to the same files. The presence of either link indicates an Amazon Linux system.

Image identification file

Each Amazon Linux image contains a unique /etc/image-id file that provides additional information about the original image as generated by the Amazon Linux team. This file is specific to Amazon Linux and is not found in other Linux distributions such as Debian, Ubuntu, or Fedora. This file contains the following information about the image:

  • image_name, image_version, image_arch – Values from the build recipe that was 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 used to construct the image.

Examples of Amazon Linux-specific files

The following sections provide examples of the Amazon Linux-specific identification files for each major version of Amazon Linux.

Note

In any real-world code, /usr/lib/os-release should be used if the /etc/os-release file does not exist.

AL2027

The following examples show the identification files for an AL2027 container image.

Example of /etc/image-id for AL2027:

cat /etc/image-id
image_name="al2027-preview-container"
image_version="2027"
image_arch="x86_64"
image_file="al2027-preview-container-2027.0.20260903.0-x86_64"
image_stamp="4a6c-c3b6"
image_date="20260903212654"
recipe_name="al2027-preview container"
recipe_id="fcf5e1a4-a276-3448-b71a-1eb1-7d2f-f464-8f6cf1f3"

Example of /etc/system-release for AL2027:

cat /etc/system-release
Amazon Linux release 2027.0.20260903 (Amazon Linux)

Example of /etc/system-release-cpe for AL2027:

cat /etc/system-release-cpe
cpe:2.3:o:amazon:amazon_linux:2027:2027.0.20260903

AL2023

The following examples show the identification files for AL2023.

Example of /etc/image-id for AL2023:

cat /etc/image-id
image_name="al2023-container"
image_version="2023"
image_arch="x86_64"
image_file="al2023-container-2023.12.20260817.0-x86_64"
image_stamp="9528-ae09"
image_date="20260812030732"
recipe_name="al2023 container"
recipe_id="980ea2f4-f357-51ba-89f2-1aa8-c495-4e2f-4bd719d3"

Example of /etc/system-release for AL2023:

cat /etc/system-release
Amazon Linux release 2023.12.20260817 (Amazon Linux)

AL2

The following examples show the identification files for AL2.

Example of /etc/image-id for AL2:

cat /etc/image-id
image_name="amzn2-container-raw"
image_version="2"
image_arch="x86_64"
image_file="amzn2-container-raw-2.0.20260710.0-x86_64"
image_stamp="8cc3-051d"
image_date="20260710034742"
recipe_name="amzn2 container"
recipe_id="6431fa04-4ce1-b2fe-b9e3-a141-5bdd-7f0e-3b752f6d"

Example of /etc/system-release for AL2:

cat /etc/system-release
Amazon Linux release 2 (Karoo)