Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Find if AWS instance is running Amazon Linux 1 or 2?

In AWS I need to add amazon linux instance to domain based on this article. However how do i know which Amazon Linux version the instance is using. I do not have access to AWS console. But i do have access to actual instance. What linux command i should be using.

I use uname -srm command which returns Linux 4.4.0-1057-aws x86_64

Not sure if this is Amazon Linux 1 or Amazon Linux 2

like image 757
LP13 Avatar asked Dec 17 '18 22:12

LP13


People also ask

What version of Linux does Amazon EC2 use?

Amazon Linux 2 (AL2) is the current Amazon Linux release that is Generally Available. AL2 supports the latest Amazon EC2 instance capabilities and is tuned for optimal performance on AWS.

How do I know my EC2 instance type?

To find an instance type using the consoleOpen the Amazon EC2 console at https://console.aws.amazon.com/ec2/ . From the navigation bar, select the Region in which to launch your instances. You can select any Region that's available to you, regardless of your location. In the navigation pane, choose Instance Types.

What OS do EC2 instances use?

Operating Systems and Software Amazon Machine Images (AMIs) are preconfigured with an ever-growing list of operating systems, including Microsoft Windows and Linux distributions such as Amazon Linux 2, Ubuntu, Red Hat Enterprise Linux, CentOS, SUSE and Debian.

Does Amazon Linux 2 have AWS CLI?

AWS integrationAmazon Linux 2 comes with many AWS tools (e.g. AWS CLI) and cloud-init. These tools are designed to simplify the scripting of common administration tasks from within an instance and enable remote configuration of instances.


1 Answers

You can use /etc/os-release file to get the info about Amazon Linux Version, the machine is running.

  1. In case of Amazon 1

    [ec2-user@ip-x-x-x- ~]$ cat /etc/os-release NAME="Amazon Linux AMI" VERSION="2018.03" ID="amzn" ID_LIKE="rhel fedora" VERSION_ID="2018.03" PRETTY_NAME="Amazon Linux AMI 2018.03" ANSI_COLOR="0;33" CPE_NAME="cpe:/o:amazon:linux:2018.03:ga" HOME_URL="http://aws.amazon.com/amazon-linux-ami/" 
  2. In case of Amazon 2

    [ec2-user@x-x-x-x ~]$ cat /etc/system-release Amazon Linux release 2.0 (2017.12) LTS Release Candidate [ec2-user@fresh-amazon-host ~]$ cat /etc/os-release NAME="Amazon Linux" VERSION="2.0 (2017.12)" ID="amzn" ID_LIKE="centos rhel fedora" VERSION_ID="2.0" PRETTY_NAME="Amazon Linux 2.0 (2017.12) LTS Release Candidate" ANSI_COLOR="0;33" CPE_NAME="cpe:2.3:o:amazon:amazon_linux:2.0" HOME_URL="https://amazonlinux.com/" 

As you can clearly see the two different versions, mentioned as Amazon Linux and Amazon Linux 2.0

like image 140
Hardeep Singh Avatar answered Oct 03 '22 00:10

Hardeep Singh