Menu
blog.headdesk.me
blog.headdesk.me

5th-generation EC2 instances

Posted on 2018/01/082021/07/24

AWS introduced 5th-generation EC2 instances in selected regions. These instances live on Nitro which is KVM based. These c5 and m5 instances are faster yet cheaper. The switch however cannot be done by a simple instance type change.

The following instructions apply to EL7

First, block devices switched to NVMe and their names changed to /dev/nvme0n1p1. If the AMI contains traditional block device names in /etc/fstab, they will be stuck at boot up. Use UUID or disk label solves the problem. Second, you may need ENA support enabled. Some of the 5th-generation instances uses 10Gbe NIC as the only option. Here is how I recently updated a CentOS AMI:

– launched a c4.large instance from existing AMI
– update kernel to the latest (yum update kernel)
– disable consistent network device naming (add biosdevname=0 net.ifnames=0 to /etc/sysconfig/grub)
– update grub config and regenerate initramfs images

grub2-mkconfig > /boot/grub2/grub.cfg
dracut --regenerate-all --force

– stop instance
– enable ENA with awscli and start instances

aws ec2 modify-instance-attribute --ena-support --instance-id i-xxx

ENA support is included on kernel 3.2 and later, so there is no need to install it on EL7

# modinfo ena
filename: /lib/modules/3.10.0-693.2.2.el7.x86_64/kernel/drivers/net/ethernet/amazon/ena/ena.ko.xz
version: 1.0.2

For EL6, the ena driver needs to be installed manually. Use DKMS to install the module, so the driver is automatically installed during future kernel upgrade.

yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm
yum install git gcc kernel-devel-$(uname -r) dkms
git clone https://github.com/amzn/amzn-drivers.git /usr/src/amzn-drivers-latest
# create file /usr/src/amzn-drivers-latest/dkms.conf
PACKAGE_NAME="ena"
PACKAGE_VERSION="latest"
CLEAN="make -C kernel/linux/ena clean"
MAKE="make -C kernel/linux/ena/ BUILD_KERNEL=${kernelver}"
BUILT_MODULE_NAME[0]="ena"
BUILT_MODULE_LOCATION="kernel/linux/ena"
DEST_MODULE_LOCATION[0]="/updates"
DEST_MODULE_NAME[0]="ena"
AUTOINSTALL="yes"

dkms add -m amzn-drivers -v latest
dkms build -m amzn-drivers -v latest
dkms install -m amzn-drivers -v latest
modprobe ena
dracut -f
poweroff (next step requires instance be stopped)
aws --region us-east-1 ec2 modify-instance-attribute --ena-support --instance-id i-xxx
start instance in m5 or c5

[[email protected] ~]# ethtool -i eth0
driver: ena
version: 1.5.0g
firmware-version:
bus-info: 0000:00:05.0
supports-statistics: yes
supports-test: no
supports-eeprom-access: no
supports-register-dump: no
supports-priv-flags: no

[[email protected] ~]# curl http://169.254.169.254/2016-09-02/meta-data/instance-type
c5.large

References:

  • https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/enhanced-networking-ena.html#enhanced-networking-ena-ubuntu

facebookShare on Facebook
TwitterTweet

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Full text search

Recent Posts

  • Dumping AWS Organization tree
  • Free is the most expensive
  • Terraform conditional resource and blocks
  • Upgrade Ubuntu 16.04 to latest release
  • Inspect and control network traffic on AWS
  • aws (8)
  • coffee (1)
  • headfi (1)
  • linux (7)
  • others (55)
  • security (2)
  • tech (36)
  • wordpress (2)

apache aws awscli azure backup cloud coffee coreos distributed filesystem docker ec2 EL8 elasticcache etckeeper featured heartbleed kernel linux mail meltdown mysql php pine python rdp rds Redhat Red Hat RHEL RHEL7 rpm Ryzen snapshot spectre SSL systemd tech terraform ubuntu ubuntu upgrade vector vpn wordpress xtreemfs yum

©2022 blog.headdesk.me | Powered by SuperbThemes & WordPress