In this article I’ll go through the advantages of using Aliyun Linux, a CentOS-based Linux distribution developed and maintained by Alibaba Cloud. Compared to other available Virtual Machines like Debian/Ubuntu or RHEL/CentOS (amongst others), Aliyun Linux is made in the cloud and for the cloud.
Alibaba optimised this distribution to the point that, if your application is going to run on an Alibaba Cloud ECS, makes a lot of sense to use it. Some of the optimisations are:
- Faster system startups.
- Better runtime performance.
- Less potential security risks.
- Capability of enable/disable
kdumpwithout rebooting the VM.
- Kernel Live Patching.
- Built-In Alibaba Cloud CLI.
- Optimized multi-threaded performance for high-spec ECS instance types.
- Optimized for MySQL scenarios.
- Several updates on kernel parameters to increase reliability.
Quick Start with Aliyun Linux
This article assumes that you already have an Alibaba Cloud account. Click here to create one. For this example, I’ll be using the web console to create a ECS instance with the latest version of Aliyun Linux 2, if you want to deploy it using Terraform, check Deploying and Best Practices with Alibaba Cloud to get an idea of how to start.
To keep things easy, let’s create the ECS Instance by using the Quick Launch mode, a very neat and tidy interface to quickly create an instance with the most common options used. If you need more control you can click on the “Custom Launch” tab.
Whichever the option you choose, the only difference compared to launching other Operating Systems is in the “Image” part, where you should choose “Aliyun Linux” from the list or dropdown.
Remember that, if you want to create the instance just to play a bit, select “Pay-As-You-Go“, otherwise just go with a “Subscription” mode where you can save some money over time. If everything looks right, click “Create Instance” in the last step and in around 1 minute or less, your Aliyun Linux-powered ECS will be ready to accept SSH connections.
Scenario Examples where Aliyun Linux stands out
We can keep talking about the technical advantages of Aliyun Linux forever, but without real-world scenarios to showcase, this would be empty. Let’s have a look to the best and most popular use-cases.
Using with ECS instance RAM roles
Forget about writing API keys and secrets to environment variables, since this Linux distribution comes with
aliyun-cli, all API calls will take advantage of the RAM role applied to the Virtual Machine itself. This makes your application deployment way safer, manageable and predictable. You can do things like:
- Pull an image from a Container Registry‘s Namespace
- Send metrics to CloudMonitor
- Connect to an RDS very securely
- Use an OSS bucket
All of the above without using credentials explicitly, quite cool if you ask me. Just make sure your RAM Role has a Policy granting access to those resources, of course!
Running heavy and problematic workloads
If you are developing a very experimental piece of software and you expect the binary to crash, freeze or behave weirdly very often, you can enable, at any time,
kdump and check what is going on.
kdump is a feature of the Linux kernel itself that creates crash dumps in the event of a kernel crash.
For this to work, just run
systemctl enable kdump.service && systemctl restart kdump.service and the next crash will be logged. To disable it, run
systemctl disable kdump.service && systemctl stop kdump.service.
Using the ECS to host both an application and a database
I still recommend you to use RDS to run databases, as it brings down the maintenance requirements from your side. It automates backups, replications with a few clicks and they run always in a very optimized environment. But if for business or technical requirements, you need a custom-made MySQL, NoSQL server or real-time analysis applications, Aliyun Linux has your back. If you connect an ESSD to the instance, you can expect a very high performance. ESSDs (Enhanced SSDs) are currently based on a 25GE network and RDMA (Remote Direct Memory Access) technology. This technology comes perfect when short latency and high throughput are required, like OLTP and other file-intensive scenarios.
As Aliyun Linux is optimized to be used on ECS instances, all operations involving instance creation, reboots and startups will happen faster and your application will scale more precisely. Personally, I find the time from launching an instance for it to be fully operative (I can see system logs) incredibly fast compared to other images, including Amazon Linux running on AWS EC2 instances.
Think about that scenarios where you have some auto-scaling rules to get triggered when certain metrics are on the limit. With faster startups times, your Load Balancers will get backends ready to get used in a much shorter time.
As you can see, even for a Debian fan like myself, Aliyun Linux comes as a natural selection when using Alibaba Cloud ECS instances. There is way less overhead when setting up my projects and using ECS in combination with other resources.
Give it a try and thank you for reading!