Use Amazon Linux 2 or RHEL on EC2
If you’re running on EC2, you have a choice of Linux distributions. Among all the options, I recommend Amazon Linux or Red Hat Enterprise Linux. Why these two?
Why Amazon Linux 2
First, Amazon Linux 2 is supported till 2023. Every other option (except RHEL) reaches end of life sooner, which means you have to rebuild your VMs sooner, and you have a higher risk of running an unsupported OS, exposing you to security breaches.
Second, Amazon Linux 2 scales down to the smallest instance, with only 512 MB memory. Other distros like Red Hat Enterprise Linux 8.4 require 2 GB 1, which increases your costs and curtails your flexibility to run every microservice in a separate VM, rather than stuffing multiple microservices into one VM, which is a bad idea.
Third, Amazon documentation is written from an Amazon Linux 2-centric point of view. For example, it says that security updates are applied on reboot. But that’s true only for Amazon Linux 2. You don’t want the cognitive overhead of looking up what the policy is for your distribution. There’s benefit in vertical integration.
Fourth, Amazon Linux 2 comes preinstalled with packages that enable easy integration with AWS. Yes, you can find out what those are and install them on other distributions, but you should instead do work that produces business value.
Fifth, Amazon Linux 2 is optimised for better performance on EC2 2.
These are all the arguments in favour of using Amazon Linux 2.
Why RHEL
It’s supported till 2024, which is one year longer than Amazon Linux 2. Considering that many startups run outdated operating systems, exposing themselves to security risks, you want to make a choice that doesn’t force you to upgrade as long as possible.
In summary, choose between Amazon Linux 2 and RHEL.
I was able to launch an instance with 1 GB memory, but running a configuration below the minimum is not a good idea even if the UI lets you do it.
Even if you’re skeptical about this claim, it’s unlikely to be slower, so using Amazon Linux 2 is still a safe choice.