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:

https://aws.amazon.com/premiumsupport/knowledge-center/enable-configure-enhanced-networking/
https://docs.aws.amazon.com/cli/latest/userguide/install-linux.html
https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/enhanced-networking-ena.html

sudo su - ec2-user
/bin/bash
sudo yum install pip
sudo yum install awscli
sudo yum install git
git clone https://github.com/amzn/amzn-drivers

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

#Driver compilation:
#===================
#Prerequisites:
#RHEL
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
depmod
# 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