AWS EC2 – Linux – RHEL& – enable ENA as prerequisite from changing instance family type from C4 or R4 to C5 or R5

When upgrading AWS EC2 instances from C4 or R4 family to the C5 and R5 instance family types, you need to ensure the ENA is enabled for the network cards in advance.

How to

Run these commands as outlined below with reference to:

sudo su - ec2-user
sudo yum install pip
sudo yum install awscli
sudo yum install git
git clone

cd ./amzn-drivers/kernel/linux/ena

#Driver compilation:
sudo yum install gcc
sudo yum install kernel-devel-$(uname -r)
# Run "make [UBUNTU_ABI=<ABI>]" in the kernel/linux/ena/ folder.
make # for rhel 7 
# ena.ko is created inside the folder

# Driver installation:
# ====================
# loading driver:
# ---------------

insmod ena.ko

# For automatic driver start upon the OS boot
# RHEL / Open Suse / Ubuntu:
# --------------------------
echo "ena">>/etc/modules-load.d/ena.conf
# if previous driver was loaded from initramfs - it will have to be updated as well (i.e. dracut)
dracut -f -v

# To avoid auto if names asignment by latest systemctl module 
sudo sed -i '/^GRUB\_CMDLINE\_LINUX/s/\"$/\ net\.ifnames\=0\"/' /etc/default/grub

# Create new Grub 
grub2-mkconfig -o /boot/grub2/grub.cfg

# Shutdown Server and Enable ENA from another server which has Admin Role 
aws ec2 modify-instance-attribute --instance-id 'i-03ff5ae675d8550e6' --ena-support

January 6, 2021