Ever tried to switch instance types from lets say t2 to m5 on SLES 12 SP3 (including SLES For SAP)? Well if you did you were in for a bad surprise in that your instance would no longer boot. Switching the instance type back away from the newer instance types c5, m5, m5d…. and restarting the instance would get everything working again. That’s of course not the way we want things to behave.
The issue has been fixed in images with a date stamp later then 20180810. For running instances addressing the issue is reasonably straight forward.
As root run:
echo 'add_drivers+=" ena ext4 nvme nvme-core virtio virtio_scsi xen-blkfront xen-netfront "' >> /etc/dracut.conf.d/07-aws-type-switch.conf mkinitrd
Newer instance types present the root volume to the guest instance from NVMe devices, while older instance types present the root device as a virtual block device. While all SLES 12 SP2 and SP3 images boot on either instance type, during initial boot the initrd gets regenerated to fit the instance type. This has the effect that when booting on the older instance types drivers needed to boot on newer instance types get removed from the initrd and vice-versa. The config change above simply makes sure that the necessary drivers for both instance types get included in the initrd when it gets regenerated and thus the problem is fixed.
What if your running instance has a longer history? Meaning way back when you started with a SLES 11 based instance or anything in between and you have been migrating your instances. Well as far as the EC2 framework is concerned you are still running an instance of the image you started and older images do not support the new instance type. Therefore EC2 will not let you switch.