Goal
You want to move an instance to a different type, for example t2.large to m7i.large or m4.xlarge to r6i.xlarge. The resize takes a few minutes. The problems come after it: an instance that fails status checks, a root volume stuck in emergency mode because /dev/xvdf became /dev/nvme1n1, or a Windows server with no network.
Most of these failures happen on the first move from an older Xen type to a Nitro type. Run the checks below before you stop anything.
Warning
Changing the type requires a stop and start. Data on instance store volumes is lost. The public IPv4 address changes unless you use an Elastic IP. Agree a maintenance window and take a snapshot or AMI first.
1. Compare the old and new instance types
aws ec2 describe-instance-types \
--instance-types t2.large m7i.large \
--query 'InstanceTypes[].{Type:InstanceType,Hypervisor:Hypervisor,Arch:ProcessorInfo.SupportedArchitectures|join(`,`,@),ENA:NetworkInfo.EnaSupport,NVMe:EbsInfo.NvmeSupport,BootModes:SupportedBootModes|join(`,`,@),MaxENIs:NetworkInfo.MaximumNetworkInterfaces}' \
--output table
Read the output like this:
| Field | What to check |
|---|---|
Hypervisor | xen → nitro means you need the ENA and NVMe checks below |
Arch | Must match the AMI. You can't move an x86_64 instance to Graviton (arm64) by changing the type. Rebuild it instead |
ENA | required means the instance must have enaSupport=true and the driver installed |
NVMe | required means EBS volumes appear as NVMe devices |
BootModes | The instance's boot mode (legacy-bios or uefi) must be in the list |
MaxENIs | Must cover the network interfaces already attached |
Check the type is offered in the instance's Availability Zone:
aws ec2 describe-instance-type-offerings \
--location-type availability-zone \
--filters Name=instance-type,Values=m7i.large Name=location,Values=eu-west-1a \
--query 'InstanceTypeOfferings[].Location'
An empty result means the type isn't available in that AZ. Pick another type, or rebuild the instance in another AZ from an AMI.
2. Check the instance's current configuration
ID=i-0123456789abcdef0
aws ec2 describe-instances --instance-ids $ID \
--query 'Reservations[].Instances[].{Type:InstanceType,ENA:EnaSupport,BootMode:BootMode,Arch:Architecture,Root:RootDeviceType,Volumes:length(BlockDeviceMappings),ENIs:length(NetworkInterfaces)}'
Rootmust beebs. You can't change the type of instance-store-backed instances.ENAempty orfalsewhile the target needs ENA: you must enable it (step 4) after confirming the driver is in the OS.BootModemay be blank on older instances. That means the AMI's default, usuallylegacy-biosfor x86.
3. Check the drivers inside the OS
Linux
# ENA driver present?
modinfo ena | head -3
# NVMe driver present, and in the initramfs (so the root disk is found at boot)?
modinfo nvme | head -3
lsinitrd 2>/dev/null | grep -i nvme # RHEL, Amazon Linux, SUSE
lsinitramfs /boot/initrd.img-$(uname -r) 2>/dev/null | grep -i nvme # Ubuntu/Debian
# Current network driver
ethtool -i eth0 | grep driver
On current Amazon Linux, Ubuntu and RHEL images both drivers are built in or shipped as modules. Older kernels, such as CentOS 6 or custom builds, may have neither.
If NVMe is missing from the initramfs, rebuild it:
sudo dracut -f --add-drivers "nvme ena" # RHEL/Amazon Linux/SUSE
sudo update-initramfs -c -k all # Ubuntu/Debian
AWS publishes a check script for this, nitro_check_script.sh, in the awslabs/aws-support-tools repository under EC2/NitroInstanceChecks. It checks ENA, NVMe and fstab in one pass.
Fix /etc/fstab before you move
On Nitro, /dev/xvdf becomes something like /dev/nvme1n1, and the number can change between boots. If an fstab line uses a device name, the boot can stop in emergency mode.
cat /etc/fstab
sudo blkid # get the UUID for each filesystem
Replace device names with UUID= and add nofail to every data volume:
UUID=3f1c... /data xfs defaults,nofail 0 2
Caution
Without
nofail, a data volume that doesn't appear or has a new name stops the boot. You then need the EC2 Serial Console or a rescue instance to recover.
Windows
# Network adapters - look for "Amazon Elastic Network Adapter"
Get-NetAdapter | Select-Object Name, InterfaceDescription, Status
# Storage drivers - look for AWS NVMe
Get-PnpDevice -Class SCSIAdapter | Select-Object FriendlyName, Status
If the ENA or AWS NVMe driver is missing or old, install it with SSM before the change:
for PKG in AwsEnaNetworkDriver AWSNVMe; do
aws ssm send-command --instance-ids $ID \
--document-name AWS-ConfigureAWSPackage \
--parameters "action=Install,name=$PKG"
done
The AWSSupport-UpgradeWindowsAWSDrivers automation runbook updates PV, ENA and NVMe drivers together, and can work offline on an instance that can't reach SSM.
Tip
On Windows, a static IP set inside the OS is bound to the old adapter. Set the NIC to DHCP before the change. The private IP is kept by the ENI anyway.
4. Make the change
# Back-out point
aws ec2 create-image --instance-id $ID --name "pre-resize-$ID-$(date +%Y%m%d)" --no-reboot
aws ec2 stop-instances --instance-ids $ID
aws ec2 wait instance-stopped --instance-ids $ID
# Only if moving to a type that requires ENA and the driver is confirmed
aws ec2 modify-instance-attribute --instance-id $ID --ena-support
aws ec2 modify-instance-attribute --instance-id $ID \
--instance-type '{"Value": "m7i.large"}'
aws ec2 start-instances --instance-ids $ID
aws ec2 wait instance-status-ok --instance-ids $ID
--no-reboot gives a crash-consistent image. For databases, stop the instance first and then create the image, or rely on a recent application-consistent backup.
5. Common errors and what they mean
| Error or symptom | Cause | Fix |
|---|---|---|
IncorrectInstanceState on modify | Instance not fully stopped | Wait for stopped, then retry |
| Modify fails saying ENA is required for the type | enaSupport attribute not set | Confirm driver, run --ena-support, retry |
InsufficientInstanceCapacity on start | No capacity for that type in the AZ right now | Retry later, choose a sibling type, or change back |
| Modify fails over the volume or ENI count | New type supports fewer EBS volumes or ENIs | Pick a larger size or detach what isn't needed |
Instance status check fails, console shows dracut or emergency shell | NVMe driver missing from initramfs, or fstab device names | Roll back, fix initramfs/fstab, retry |
| Starts but unreachable, no network on Windows | ENA driver missing or static IP on old NIC | Roll back, or fix via EC2 Serial Console / offline driver runbook |
Read the console output for boot problems without logging in:
aws ec2 get-console-output --instance-id $ID --latest --output text | tail -50
6. Roll back
Rolling back is the same change in reverse. It works as long as nothing else changed:
aws ec2 stop-instances --instance-ids $ID --force
aws ec2 wait instance-stopped --instance-ids $ID
aws ec2 modify-instance-attribute --instance-id $ID --instance-type '{"Value": "t2.large"}'
aws ec2 start-instances --instance-ids $ID
Leaving enaSupport enabled is harmless on the old type if the driver is present. If the root volume itself is damaged, launch from the pre-resize AMI.
After the change
- Confirm the application, not just status checks: service health, mounted volumes (
lsblk,df -h), and the expected NIC driver (ethtool -i eth0showsena). - Update the type in Terraform, CloudFormation or the launch template, so the next deploy doesn't revert it.
- Check Reserved Instance or Savings Plan coverage. An instance family change can leave reservations unused. Check the current coverage report rather than assuming.
Prevent it next time
- Bake ENA, NVMe and UUID-based fstab entries with
nofailinto your golden AMIs, so any instance can move to Nitro types. - Add
nitro_check_script.shor the Windows driver check to your AMI pipeline tests. - Prefer replacing instances from a launch template over resizing pets in place. Resizing then becomes a rolling update, not a maintenance window.
Get the weekly HubDatAI email
One email a week with everything new: posts, learning sessions and videos. Free, no spam, unsubscribe in one click. What you get