My system requires more CPU or memory than is available on my current Amazon Elastic Compute Cloud (Amazon EC2) Linux instance type. I want to know what steps I need to take before I change the instance type of my Linux instance.
Short description
When you change the instance type, you can modify the following configurations for your workload:
- Number of CPU cores
- Amount of RAM
- Amount of assigned instance store space
- Amazon Elastic Block Store (Amazon EBS) optimization
- Enhanced networking
- GPU cores
- FPGAs
- Machine learning accelerators
Note: It's a best practice to keep backups of your instances and data. Before you change your infrastructure, create an Amazon Machine Image (AMI) of your instance or create snapshots of your Amazon EBS volumes.
Resolution
Verify that your current instance type is compatible with the new instance type
Before you change instance types or instance families, verify that the current instance type and the new instance type are compatible.
Stop your instance
Important: Before you stop and start your instance, take the following actions:
Note: When you stop and start an instance, the instance's public IP address changes. It's a best practice to use an Elastic IP address to route external traffic to your instance instead of a public IP address. If you use Amazon Route 53, then you might have to update the Route 53 DNS records when the public IP address changes.
To change instance types, you must stop your instance. It can take a few minutes for the instance to stop.
(Optional) Configure enhanced networking
If you convert to an instance type that supports enhanced networking, then install any required drivers. Also, activate enhanced networking on your current instance.
(Optional) Configure for Nitro-based instance types
If you changed your instance type to a Nitro-based instance type, then take the following actions:
- Confirm that you installed the NVMe and ENA modules on your instance.
- Confirm that the block devices listed in /etc/fstab are compatible with NVMe block device names such as /dev/nvme1 and */dev/nvme2.
Note: EBS volumes appear as NVMe devices to Nitro-based instance types. To avoid volume mismatch, use the UUIDs or labels when you mount the file systems.
To automate these checks, run the NitroInstanceChecks script. To access the script, see nitro_check_script.sh on the GitHub website. For installation instructions, see Automatically check prerequisites before you migrate on Why doesn't my Linux instance boot after I changed it to a Nitro-based instance?
After you run the script and make the necessary updates, verify that the DRIVERS entry in /etc/udev/rules.d/70-persistent-net.rules is set to ?* or ENA. To access the file, use a text editor such as vi editor. Example:
vi /etc/udev/rules.d/70-persistent-net.rules
Check the file entry. The following example shows a correct entry:
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="01:23:45:67:89:ab", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0
If needed, update the entry to set DRIVERS to ?* or ENA.
Check the compatibility of your instance architecture
If your instance's source AMI is built for a specific architecture, then you can only create instance types with the same architecture. For example, the 32-bit (i386), 64-bit (x86_64), and 64-bit ARM (arm64) AMIs and mac1 AMIs are built for specific architecture. You can't move these images between instance types.
Related information
Status checks for Amazon EC2 instances
Amazon EC2 pricing
How do I resolve network performance issues with sixth generation and later Amazon EC2 instances?