Arch Linux AMIs for Amazon Web Services

From ArchWiki

This article or section is out of date.

Reason: Collecting dead links, e.g. the ec2 AUR package was removed for being 4 years out of date. (Discuss in Talk:Arch Linux AMIs for Amazon Web Services)

Public community Arch AMIs

Note: Arch Linux currently does not offer official Amazon Machine Images. The ones listed here are created by the community.

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:

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.

Note: As of 2023-06-12, there is confirmation that EC2 optimized kernel from UplinkLabs hangs upon boot when running on an instance family using the XEN hypervisor (e.g. 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.
Note: ec2 repository ships other packages alongside linux-ec2 kernel. On default, ec2 is set as the top most repository in 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:

Note: The API endpoint may change without warning.

First Run

Note: The mirror list baked into the AMI was generated at time of image build and is using servers in Germany.

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

Note: This section provides a short description on how the AMIs are build.

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[dead link 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[dead link 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-v2

Building Arch AMIs

You can also build your own Arch Linux AMI. Here are some guides:

AMI Images from Uplink Labs

This article or section is out of date.

Reason: The AMIs provided by Uplink Labs are no longer maintained (Discuss in Talk:Arch Linux AMIs for Amazon Web Services)

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/ .