What steps do I need to take before changing the instance type of my EC2 Linux instance?
My system requires more CPU or memory than is available on my current Amazon Elastic Compute Cloud (Amazon EC2) instance. What steps do I take before resizing my instance to be sure that the transition is successful?
Short description
Changing the instance type of your EC2 Linux instance allows you to change the following:
- 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 maintain backups of your instances and data. Consider creating an AMI or creating snapshots of your EBS volumes before you change your infrastructure.
Resolution
Before changing instance types or instance families, verify that the current instance type and the new instance type are compatible. The following common issues cause compatibility problems when changing instance types. For a full list of compatibility issues, see Compatibility for changing the instance type.
After you verify compatibility, you can change the instance type of your Amazon EBS-backed instance.
Stop your instance
You must stop your instance before you change instance types. Before stopping your instance, be sure you understand the following:
- If your instance is instance store-backed or has instance store volumes containing data, the data is lost when you stop the instance. If you're moving from one instance store-backed instance to another instance store-backed instance, you must migrate your instance store-backed instance. For more information, see Migrate an instance store-backed instance.
- If your instance is part of an Amazon EC2 Auto Scaling group, stopping the instance might terminate the instance. If you launched the instance with Amazon EMR, AWS CloudFormation, or AWS Elastic Beanstalk, your instance might be part of an AWS Auto Scaling group. Instance termination in this scenario depends on the instance scale-in protection settings for your Auto Scaling group. If your instance is part of an Auto Scaling group, then temporarily remove the instance from the Auto Scaling group before starting the resolution steps.
- If you're not using an Elastic IP address, stopping and starting the instance changes the public IP address of your instance. It's a best practice to use an Elastic IP address instead of a public IP address when routing external traffic to your instance. If you are using Route 53, you might have to update the Route 53 DNS records when the public IP changes.
Enhanced networking
If you're converting to an instance that supports enhanced networking, install any required drivers and enable enhanced networking on your current instance. For more information, see Enhanced networking on Linux.
Nitro-based instance types
If you plan on changing your instance to a Nitro-based instance type, do the following:
- Check that the NVMe and ENA modules are installed on your instance.
- Check that any block devices listed in /etc/fstab are compatible with NVMe block device names (/dev/nvme1, /dev/nvme2, and so on).
- Amazon Elastic Block Store (Amazon EBS) volumes are exposed as NVMe devices to these instance types, and the device names are changed on a stop/start event. To avoid volume mis-match, mount the file systems using filesystem UUIDs or labels.
To automate these checks, run the NitroInstanceChecks script. For more information, see Why is my Linux instance not booting after I changed its type to a Nitro-based instance type. Follow the instructions in the Run the NitroInstanceChecks script section.
After the script runs and you made all necessary updates, verify that the DRIVERS entry in /etc/udev/rules.d/70-persistent-net.rules is set to ? or ENA.
Use a text editor to access the file. The following example uses the vi editor.
vi /etc/udev/rules.d/70-persistent-net.rules
The correct entry appears as follows:
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="01:23:45:67:89:ab", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0
Networking on current generation instances
Current generation instances launch only in a virtual private cloud (VPC). If your current instance is an EC2-Classic instance, then migrate the instance to a Linux instance in a VPC.
Mixing EC2 architectures
If your instance's source AMI is built for a specific architecture, you're restricted to creating instance types of the same architecture. Examples of AMIs built for specific architecture might include 32-bit (i386), 64-bit (x86_64), or 64-bit ARM (arm64). This is also the case if your instance is running an AMI created for the mac1 instance type. You can't move these images between instance types.
Related information
Migrate to a new instance configuration
Ähnliche Videos

Relevanter Inhalt
- AWS OFFICIALAktualisiert vor einem Jahr
- AWS OFFICIALAktualisiert vor 2 Jahren
- AWS OFFICIALAktualisiert vor 3 Monaten
- AWS OFFICIALAktualisiert vor 8 Monaten