Can I use kernel modules on Amazon HVM/PV instances?

kagali-san asked:

It’s a perfectly stupid idea, I know.
But I want to test one of my older projects, which includes kernel module (Netfilter extension) on a virtualized cloud-y instance.

Will it be possible for me to plug kernel code into Amazon’s virtualized (I see they’re using Xen.. instances?

(I think, if preparing an AMI for HVM includes a kernel configuration to support Xen drivers, then it must be possible to load a “normal” module..)

My answer:

You can load any kernel module you want on HVM instances. By default, most newly created instances are HVM, and on the free tier, only HVM instances can be used.

But you may have trouble on PV instances, as these require a special Xen-aware kernel which is sometimes booted from an AKI outside the instance. This is especially true of very old instances created prior to Amazon introducing pvgrub support for PV instances. If your PV instance is newer and boots a pvgrub AKI, then a Xen-aware kernel inside the instance is used, and you can use any module compiled for that kernel.

View the full question and answer on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.