Amazon allows VMs custom Linux kernel on EC2

Amazon just announced a new, remarkable option available for customers of its Xen-based Infrastructure-as-a-Service (IaaS) cloud computing platform: Elastic Compute Cloud (EC2).

From now on, the EC2 virtual machines (called Amazon Machine Images or IMAs) will be able to load custom Linux kernels.

Customers have to use a Linux kernel that supports the Xen’s pv_ops (paravirtual ops) infrastructure with XSAVE disabled or the Xen 3.0.2 interface, and perform some specific configuration steps.

To enable user provided kernels, Amazon has published a set of Amazon Kernel Images (AKIs) that use a system called PVGrub. PVGrub is a para‐virtual “mini‐OS” that runs a version of GNU GRUB, the standard Linux boot loader. PVGrub selects the kernel to boot by reading /boot/grub/menu.lst from your image. It will load the kernel specified by your image and then shutdown the “mini‐OS”, so that it no longer consumes any resources. One of the advantages of this solution is that PVGrub understands standard grub.conf or menu.lst commands, allowing it to work with most existing Linux distributions.

So far Amazon tested the following kernels:

  • Fedora 8-12 Xen kernels
  • SLES/openSUSE 10x, 11.0, and 11.1 Xen kernels
  • SLES/openSUSE 11.x EC2 Variant
  • Ubuntu EC2 Variant
  • RHEL 5.x
  • CentOS 5.x

With some additional hacks the same procedure could be used to run non-supported guest operating systems (like FreeBSD) on EC2: Amazon seems fine with this and invites customers to report any success.

The new capability will open doors to highly specialized Linux kernels that can either perform better or offer features that don’t make sense in user space.