Arch Linux AMIs for Amazon Web Services (Português)
Public community Arch AMIs
AMIs
Arch Linux AMIs are listed here: http://arch-ami-list.drzee.net/
AMIs are build twice a month (the 1st and the 15th - 2:00am UTC) and are available for all regions that to do not explicitly require 'Opt-in' - see Region List. If an AMI is needed in a region where its currently not available, an AMI can be copied to that region.
The AMIs are EBS HVM AMIs and are available with two different kernels:
- std - using the Standard Arch Linux Kernel from the default Arch repositories configured with the necessary modules for EC2 usage. The scheduler and I/O is not optimized for Cloud usage reducing performance.
- ec2 - using an EC2 optimized kernel of the Standard Arch Linux Kernel created by UplinkLabs and hosted in a dedicated repository: https://arch-linux-ami.s3.amazonaws.com/repo/$arch[link inativo 2022-09-17 ⓘ] (see also https://git.uplinklabs.net/steven/ec2-packages.git)
Both kernels have been tested on many different EC2 instance types (t2, t3, t3a, m/r/c5, m/r/c6 and advanced hardware with GPUs) and are booting fine.
t2-micro
). The XEN kernel modules are not included in the latest kernel which is why the boot fails. Please use only instance families using the new Nitro Hypervisor - see: Instances build on Nitro. These will still work with the EC2 optimized kernel.pacman.conf
. As a result, packages from ec2 may have a higher priority than those from the Official repositories. This can lead to some inconsistent behaviors depending on actual versions of packages.AMIs with LTS kernels are not build.
REST API to List AMIs
An REST API is available to get a JSON of available AMIs:
- Get all AMIs:
https://5nplxwo1k1.execute-api.eu-central-1.amazonaws.com/prod
- Get list of latest AMI in each region:
https://5nplxwo1k1.execute-api.eu-central-1.amazonaws.com/prod/latest
(this produces the same list as http://arch-ami-list.drzee.net/ but in JSON) - Get all AMIs in region:
https://5nplxwo1k1.execute-api.eu-central-1.amazonaws.com/prod/region
- replaceregion
with the desired region:eu-north-1
,eu-west-1
,us-east-1
etc. - Get all AMIs in region for CPU architecture:
https://5nplxwo1k1.execute-api.eu-central-1.amazonaws.com/prod/region/arch
- replacearch
withx86_64
- Get all AMIs in region for CPU architecture and kernel-type:
https://5nplxwo1k1.execute-api.eu-central-1.amazonaws.com/prod/region/arch/type
- replacetype
withstd
orec2
- Get Latest AMI in region for in region for CPU architecture and kernel-type:
https://5nplxwo1k1.execute-api.eu-central-1.amazonaws.com/prod/region/arch/type/latest
- replaceregion
,arch
andtype
First Run
After booting the AMI it is recommended/required to execute the following steps to initialize pacman and select fast local repositories:
# pacman-key --init # pacman-key --populate # reflector --country "ISO 3166-1 Alpha-2 Country Code" --protocol https,http --score 20 --sort rate --save /etc/pacman.d/mirrorlist # pacman -Syu
The Reflector package is preinstalled in the AMIs.
It is recommended to set a proper configuration for reflector in /etc/xdg/reflector/reflector.conf
and enable the timer services to regularly refresh the mirror list. For details see the Reflector package documentation.
Alternative provide your own mirrorlist and do not use the reflector package.
Build process
The entire build process runs on AWS and is fully automated.
Overall the automated build procedure is managed by a AWS Step Function that is executed at regular intervals using a Amazon EventBridge timed event.
The step function will initiate the build process and uses a combination of native calls and AWS Lambda functions for more complex elements.
A new set of AMIs is build, by booting an EC2 instance with the previous AMI and using it as the work or build machine. The build machine is bootstrapped with a special build script that largely follows the steps outlined here: http://mathcom.com/arch.aws.ami.html[link inativo 2023-04-22 ⓘ] with some minor modifications, tweaks and additions. Step 7.4 is skipped as we do not need a dedicated firewall.
Following the build of the AMI the new AMI is test booted on an EC2 instance to verify that it start up correctly. If successful the AMI is distributed to the regions and registered in a DynamoDB database. The database can be queried using the API REST endpoint. Old AMIs are deleted from the regions and the DynamoDB database.
Credits
Thanks to Steven from UplinkLabs for helping to understand the build process and test the initial quality of the images. Also thanks to Mathcom for the guide[link inativo 2023-04-22 ⓘ], which accelerate putting the basic build process together.
You may send comments and suggestions (without any promise that they will be looked at) to: arch-ami 'at' drzee.net
Wishlist
- Create official EC2/Cloud optimized kernels in the Standard Arch Linux repositories.
-
Add the AWS CLI v2 to the Standard Arch Linux repositories (v1 is available, but may be discontinued in the future)- Thanks to yan12125 for adding aws-cli-v2AUR
Building Arch AMIs
You can also build your own Arch Linux AMI. Here are some guides:
- linux-ec2AUR[link quebrado: package not found] compiles the Arch Linux kernel for AWS with Xen modules enabled and the XSAVE patch applied. Note that at least some instance types will also work with the stock Arch Linux kernel.
- Uplink Labs has a manual on the build process.
- Another tutorial on building your own AMIs can be found at https://gitlab.com/anemos-io/archlinux-ec2
- Mathcom publishes a detailed guide that uses only core Arch tools, at http://mathcom.com/arch.aws.ami.html[link inativo 2023-04-22 ⓘ]
AMI Images from Uplink Labs
Uplink Labs creates new images approximately twice a month. Images are being built for a number of regions, and cover the following configurations:
- ebs hvm x86_64 lts
- s3 hvm x86_64 lts
- ebs hvm x86_64 stable
- s3 hvm x86_64 stable
AMI links and more information are available at https://www.uplinklabs.net/projects/arch-linux-on-ec2/ .