Often when resizing instance types it just a simple case of shutting the EC2 down, changing the type then starting it up but when changing to an M5 or C5 type the EC2 may not boot up which is normally because it does not have either the enhanced networking module installed, the NVMe module installed or you may have block devices mounted using the device names, fortunately there is an AWS script that can be used to run the pre-requisite tests to ensure these are identified and rectified before attempting the resizing of the instance.

This guide shows you how to run the pre-requisite script to give you the best chance of a successful instance resizing.

This assumes a standard non M5/C5 Linux instance is running such as T2/T3 that you would be looking to increase in specification.

The script will run the following pre-requisites checks before changing the instance type to M5/C5
 - Verify if NVMe module is installed on your instance. If yes then it will verify if it is loaded in the intiramfs image.
 - Verify if ENA module is installed on your instance.
 - Analyses the "/etc/fstab" and look for the block devices being mounted using device names.

Download the script from GitHub

wget https://raw.githubusercontent.com/awslabs/aws-support-tools/master/EC2/C5M5InstanceChecks/c5_m5_checks_script.sh

Make the script executable

chmod +x c5_m5_checks_script.sh

Run the script as sudo or root

sudo ./c5_m5_checks_script.sh

Allow the script to run and if everything is as expected you should get OK for the pre-requisite checks, you can now go ahead and arrange downtime to resize your instance to an M5 or C5.

If any of the checks fail, depending on what OS you are running, the AWS documentation has full details on how to install or upgrade the missing components, it is strongly recommended to take snapshots of all EBS volumes before any changes are made. Once the issues have been rectified run the script again until all checks show OK giving you the green light to make the type change, saving you the stress and pain of finding out there is an issue when you take a production server offline to resize.