How can I find the OS platform or version my EC2 Linux instance is using?

Last updated: 2021-01-06

I want to find the operating system (OS) or version number running on my Amazon Elastic Compute Cloud (Amazon EC2) instance. How do I do this if I didn't allocate OS-specific tags to my instance at launch?

Short description

Public AMIs list what distribution they're based on in the Description or Name parameters. When you generate a new AMI based on a public AMI, the distribution switches to Custom Linux, and you might not able to view the platform-related information.

Resolution

Using the Amazon EC2 console

From the Amazon EC2 console, you can use one of the following three methods to check the OS or version number:

  • View the Platform details or AMI ID information.
  • View the instance's console logs or screenshot.
  • View platform information for AWS Systems Manager Managed instances.

View the Platform details or AMI ID information

New Amazon EC2 console:

  1. Select the instance.
  2. On the Details tab, view OS and version information in the Platform details field. Or, select the AMI ID.

Old Amazon EC2 console:

  1. Select the instance.
  2. On the Description tab, view OS and version information from the AMI ID Platform.
  • Platform Details: View the Platform details field for the (inferred) platform the instance is using.
  • AMI ID: Select the link under the AMI ID field to open the AMIs dashboard. Check the Details tab for information about the operating system and version.
    Note: The AMIs dashboard might default to showing AMIs Owned by me. You can change this filter to Public images or Private images, if needed.

View the instance's console logs or screenshot

New Amazon EC2 console:

  1. Select the instance.
  2. Choose Actions, Monitor and troubleshoot, Get system log.
  3. Search for a keyword, such as Linux or kernel to look in the log entries.

-or-

  1. Select the instance.
  2. Choose Actions, Monitor and troubleshoot, Get instance screenshot.

Old Amazon EC2 console:

  1. Select the instance.
  2. Choose Actions, Instance Settings, Get system log.
  3. Search for a keyword, such as Linux or kernel to look in the log entries.

-or-

  1. Select the instance.
  2. Choose Actions, Instance Settings, Get instance screenshot.

Note: AWS has limited visibility into the software or OS that's running on an instance. This means that AWS can't provide specific OS-related information. AWS predicts the information in the Platform details field based on the AMI name and description. Because of this, the listed platform isn't always accurate for the preceding two methods. If the console logs are enabled by default, then the logs usually show the OS and version that your instance uses.

View platform information for AWS Systems Manager Managed instances

  1. Open the Managed instances console.
  2. Select the instance. The instance's Platform type, Platform name, and Platform version appear.

Note: A managed instance is any machine or instance configured with AWS Systems Manager. To appear on the AWS Systems Manager Managed Instances tab, instances must be running, have the amazon-ssm-agent installed, and have the required AWS Identity and Access Management (IAM) permissions assigned to them.

For information on prerequisites for using AWS Systems Manager, see Systems Manager prerequisites.

Using the AWS Command Line Interface (AWS CLI) on managed instances

You can use the AWS CLI to view the Linux OS platform and version information for instances that have the ssm-agent installed and configured. Run the following commands to install and use the jquery utility followed by the ssm describe-instances-information command. In the following example command, replace us-east-1 with your Region.

Note: If you receive errors when running AWS CLI commands, make sure that you’re using the most recent version of the AWS CLI.

# sudo yum install -y jq*
# aws ssm describe-instance-information --query 'InstanceInformationList[*].[InstanceId,PlatformType,PlatformName]' --output table  --region us-east-1
------------------------------------------------------
|             DescribeInstanceInformation            |
+----------------------+--------+--------------------+
|  i-0e446328e4070b25c |  Linux |  SLES              |
|  i-09ab5fd0cf37a45da |  Linux |  Amazon Linux AMI  |
|  i-0dd6cd6c3210f605e |  Linux |  SLES              |
|  i-05dd60329fb29cd74 |  Linux |  Ubuntu            |
+----------------------+--------+--------------------+

$ aws ssm describe-instance-information --region us-east-1
{
    "InstanceInformationList": [
        {
            "IsLatestVersion": false, 
            "ComputerName": "ip-172-31-39-244.ec2.internal", 
            "PingStatus": "Online", 
            "InstanceId": "i-0b89uiydekijihuh", 
            "IPAddress": "172.31.39.244", 
            "ResourceType": "EC2Instance", 
            "AgentVersion": "2.3.978.0", 
            "PlatformVersion": "15.1", 
            "PlatformName": "SLES", 
            "PlatformType": "Linux", 
            "LastPingDateTime": 1593669078.246
        }
}

Did this article help?


Do you need billing or technical support?