CentOS7 AWS AMI with ENA
I swear I don’t like to load titles with initialisms like that, but let’s be honest you just googled exactly that.
While it’s not hard to find an AMI on the marketplace with ENA enabled, none of them are official, and some of them tack on as much as $0.40/hr if you’re not paying attention.
Here’s how to make your own in about 5 minutes for free.
- Spin up a regular old instance with the official, not-ENA-enabled Centos7 image, eg: https://aws.amazon.com/marketplace/pp/B00O7WM7QW
- Check if it’s already compatible, which it probably is:
$ modinfo ena
filename: /lib/modules/3.10.0-1127.19.1.el7.x86_64/kernel/drivers/net/ethernet/amazon/ena/ena.ko.xz
version: 2.0.3K
license: GPL
description: Elastic Network Adapter (ENA)
author: Amazon.com, Inc. or its affiliates
retpoline: Y
rhelversion: 7.8
srcversion: 3E0F01EBC629D59AD4CEA6A
alias: pci:v00001D0Fd0000EC21sv*sd*bc*sc*i*
alias: pci:v00001D0Fd0000EC20sv*sd*bc*sc*i*
alias: pci:v00001D0Fd00001EC2sv*sd*bc*sc*i*
alias: pci:v00001D0Fd00000EC2sv*sd*bc*sc*i*
depends:
intree: Y
vermagic: 3.10.0-1127.19.1.el7.x86_64 SMP mod_unload modversions
signer: CentOS Linux kernel signing key
sig_key: B1:6A:91:CA:C9:D6:51:46:4A:CB:7A:D9:B8:DE:D5:57:CF:1A:CA:27
sig_hashalgo: sha256
parm: debug:Debug level (0=none,...,16=all) (int)
3. If it’s not, just upgrade the kernel. Why not all the base packages while you’re there? sudo yum update
4. Shut down the instance and run:
aws ec2 modify-instance-attribute --instance-id ID_HERE --ena-support --region REGION_HERE
At this point you have an instance that can use ENA. If you’ve got existing instances the you want to change to instance types that require ENA you can just use the preceding steps.
From here there’s no more magic. Clean up the disk so that the AMI snapshot is small and doesn’t use any more storage than necessary:
sudo yum clean all; dd if=/dev/zero of=/zero bs=16M; rm -f /zero
Shut it down, create the AMI, and enjoy not paying an hourly sucker fee to some wiener on the AWS Marketplace.
Refs: