AWS

What Is Amazon Linux 2?

Amazon is the largest player in the cloud market, and its Amazon Web Services (AWS) cloud computing platform has maintained a very strong growth rate since its launch in 2006.

To help its customers take full advantage of its cloud offering, the company created its own Linux server operating system, called Amazon Linux. Based on Red Hat Enterprise Linux (RHEL), Amazon Linux stands out thanks to its tight integration with many Amazon Web Services (AWS) services, long-term support, and a compiler, build toolchain, and LTS Kernel tuned for better performance on Amazon EC2.

In December 2017, Amazon announced the second version of its Linux operating system: Amazon Linux 2. Just like its predecessor, Amazon Linux 2 will be supported for 5 years with security and maintenance updates, until June 30, 2023.

Meet Amazon Linux 2

Amazon has many customers around the world whose applications and infrastructure live entirely on its cloud servers. For such customers, it makes a lot of sense to use an operating system that has been designed to easily integrate with Amazon’s cloud-computing platform and squeeze out every ounce of performance out of it.

Stable Bleeding Edge

With Amazon Linux 2, customers also get to enjoy two benefits that don’t often go together: long-term support and access to the latest versions of popular software packages. Long-term support applies to core packages (whose full list can be found on the Amazon Linux 2 FAQ page). Amazon promises to provide security updates and bug fixes for 5 years.

One important caveat is that Amazon Linux 2 doesn’t maintain kernel-space ABI compatibility, so changes in the upstream Linux kernel that break ABI stability, then any applications that rely on third-party kernel drivers may require additional modifications.

At the time of writing, the default kernel in Amazon Linux 2, which receives long-term support from Amazon, is Linux Kernel 4.14. Users can, however, easily upgrade to an AWS-optimized Linux Kernel 4.19 by installing it from the Extras catalog, a repository of bleeding-edge software, including kernels, runtimes, toolchains, databases, web stacks, and more.

Installing the Linux Kernel 4.19 is a matter of one simple command:

sudo amazon-linux-extras install kernel-ng

Other available software in the Extras catalog can be listed using the following command:

amazon-linux-extras list
0  ansible2                 available    [ =2.4.2  =2.4.6  =2.8 ]
2  httpd_modules            available    [ =1.0 ]
3  memcached1.5             available    [ =1.5.1  =1.5.16 ]
5  postgresql9.6            available    [ =9.6.6  =9.6.8 ]
6  postgresql10             available    [ =10 ]
8  redis4.0                 available    [ =4.0.5  =4.0.10 ]
9  R3.4                     available    [ =3.4.3 ]
10  rust1                    available    \
[ =1.22.1  =1.26.0  =1.26.1  =1.27.2  =1.31.0 ]
11  vim                      available    [ =8.0 ]
13  ruby2.4                  available    [ =2.4.2  =2.4.4  =2.4.7 ]
15  php7.2                   available    \
[ =7.2.0  =7.2.4  =7.2.5  =7.2.8  =7.2.11  =7.2.13  =7.2.14
=7.2.16  =7.2.17  =7.2.19  =7.2.21 ]
16  php7.1                   available    \
[ =7.1.22  =7.1.25  =7.1.27  =7.1.28  =7.1.30  =7.1.31 ]
17  lamp-mariadb10.2-php7.2  available    \
[ =10.2.10_7.2.0  =10.2.10_7.2.4  =10.2.10_7.2.5
=10.2.10_7.2.8  =10.2.10_7.2.11  =10.2.10_7.2.13
=10.2.10_7.2.14  =10.2.10_7.2.16  =10.2.10_7.2.17
=10.2.10_7.2.19  =10.2.10_7.2.21 ]
18  libreoffice              available    [ =5.0.6.2_15  =5.3.6.1 ]
19  gimp                     available    [ =2.8.22 ]
20  docker=latest            enabled      \
[ =17.12.1  =18.03.1  =18.06.1 ]
21  mate-desktop1.x          available    [ =1.19.0  =1.20.0 ]
22  GraphicsMagick1.3        available    [ =1.3.29  =1.3.32 ]
23  tomcat8.5                available    \
[ =8.5.31  =8.5.32  =8.5.38  =8.5.40  =8.5.42 ]
24  epel                     available    [ =7.11 ]
25  testing                  available    [ =1.0 ]
26  ecs                      available    [ =stable ]
27  corretto8                available    \
[ =1.8.0_192  =1.8.0_202  =1.8.0_212  =1.8.0_222 ]
28  firecracker              available    [ =0.11 ]
29  golang1.11               available    \
[ =1.11.3  =1.11.11  =1.11.13 ]
30  squid4                   available    [ =4 ]
31  php7.3                   available    \
[ =7.3.2  =7.3.3  =7.3.4  =7.3.6  =7.3.8 ]
32  lustre2.10               available    [ =2.10.5 ]
33  java-openjdk11           available    [ =11 ]
34  lynis                    available    [ =stable ]
35  kernel-ng                available    [ =stable ]
36  BCC                      available    [ =0.x ]
37  mono                     available    [ =5.x ]
38  nginx1                   available    [ =stable ]
39  ruby2.6                  available    [ =2.6 ]

On-Premises Development and Testing

It probably won’t surprise you that Amazon Linux 2 is available as an Amazon Machine Image (AMI) for use on Amazon Elastic Compute Cloud (AmazonEC2) and as a Docker container image compatible with Amazon Elastic Container Service (Amazon ECS).

What may surprise you is that you can also download virtual machine images for VMware, Oracle VM VirtualBox, and Microsoft Hyper-V virtualization solutions for on-premises software development and testing.

To get Amazon Linux 2 running on a local machine, all you need to do is prepare a boot image with initial configuration information, download the Amazon Linux 2 virtual machine image for your virtualization platform of choice, and boot to your new VM. The first step is also the only one that requires users to consult the Amazon Linux 2 user guide.

From SysVinit to systemd

The previous version of Amazon Linux relied on SysVinit to bootstrap the Linux user space and manage system processes afterward.

While simple and compact, SysVinit wasn’t designed to meet the needs of modern users and start the large number of processes users have come to rely on over the years. Furthermore, SysVinit starts processes serially, which means that it has to wait for each process to load before it can start loading the next process. Configuring the load order of processes is a lot of work and not a whole lot of fun.

Systemd provides a dependency-based init system capable of bootstrapping the Linux user space in parallel. This leads to significant performance improvements over SysVinit. Systemd also includes features like on-demand starting of daemons, snapshot support, process tracking, and Inhibitor Locks that make it a suite of basic building blocks for a Linux system.

Security First

Amazon Linux 2 limits exposure to security vulnerabilities by reducing the number of non-critical packages which are installed on an instance. Amazon Linux 2 yum repositories serve as the primary channel for delivering security updates, but security updates also reach users via updated Amazon Machine Images (AMIs) and VM and container images.

All security events are listed in the Amazon Linux AMI Security Center, which also provides a handy RSS feed. Users who would like to further boost their cyber defenses can take advantage of the hundreds of security solutions available on the AWS Marketplace, including Trend Micro Deep Security.

“Trend Micro loves Linux because our customers love Linux. Linux is truly a first-class citizen at Trend Micro and our launch support for AL2 another example of our commitment to protecting our customers’ evolving workloads,” stated Trend Micro on its website. “Whether you’re running your AL2 in AWS, on virtual servers or in containers, Deep Security delivers layered protection for your hybrid environment.”

Premium customer support options are available through subscriptions to AWS Support, but they don’t cover the on-premises use of Amazon Linux 2, which sets them apart from similar subscription options offered by Red Hat.

Conclusion

When it comes to running Linux workloads on AWS, Amazon Linux 2 is an easy choice. Combining long-term support with convenient access to bleeding-edge software, this RHEL-based Linux distribution provides a convenient entry-point into the world of Amazon Web Services and the infinite possibilities that come with it.

About the author

David Morelo

David Morelo is a professional content writer in the technology niche, covering everything from consumer products to emerging technologies and their cross-industry application