Amazon Linux Specific - Amazon Linux 2023
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

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 /etc/os-release standard in order to be cross-distribution compatible. Use of any Amazon Linux specific files is discouraged.

The /etc/system-release file

Amazon Linux contains an /etc/system-release file that specifies the current release that is installed. This file is updated using package managers and on Amazon Linux is part of the system-release package. While 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.

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.

AL2023

The following examples show the identification files for AL2023.

Example of /etc/image-id for AL2023:

[ec2-user ~]$ cat /etc/image-id
image_name="al2023-container"
image_version="2023"
image_arch="x86_64"
image_file="al2023-container-2023.8.20250721.2-x86_64"
image_stamp="822b-1a9e"
image_date="20250719211531"
recipe_name="al2023 container"
recipe_id="89b25f7b-be82-2215-a8eb-6e63-0830-94ea-658d41c4"

Example of /etc/system-release for AL2023:

[ec2-user ~]$ cat /etc/system-release
Amazon Linux release 2023.8.20250721 (Amazon Linux)

AL2

The following examples show the identification files for AL2.

Example of /etc/image-id for AL2:

[ec2-user ~]$ cat /etc/image-id
image_name="amzn2-container-raw"
image_version="2"
image_arch="x86_64"
image_file="amzn2-container-raw-2.0.20250721.2-x86_64"
image_stamp="4126-16ad"
image_date="20250721225801"
recipe_name="amzn2 container"
recipe_id="948422df-a4e6-5fc8-ba89-ef2e-0e1f-e1bb-16f84087"

Example of /etc/system-release for AL2:

[ec2-user ~]$ cat /etc/system-release
Amazon Linux release 2 (Karoo)

Amazon Linux AMI

The following examples show the identification files for Amazon Linux AMI.

Example of /etc/image-id for Amazon Linux AMI:

[ec2-user ~]$ cat /etc/image-id
image_name="amzn-container-minimal"
image_version="2018.03"
image_arch="x86_64"
image_file="amzn-container-minimal-2018.03.0.20231218.0-x86_64"
image_stamp="407d-5ef3"
image_date="20231218203210"
recipe_name="amzn container"
recipe_id="b1e7635e-14e3-dd57-b1ab-7351-edd0-d9e0-ca6852ea"

Example of /etc/system-release for Amazon Linux AMI:

[ec2-user ~]$ cat /etc/system-release
Amazon Linux AMI release 2018.03