

# Amazon EC2 instance type changes
<a name="ec2-instance-resize"></a>

As your needs change, you might find that your instance is over-utilized (the instance type is too small) or under-utilized (the instance type is too large). If this is the case, you can resize your instance by changing its instance type. For example, if your `t2.micro` instance is too small for its workload, you can increase its size by changing it to a bigger T2 instance type, such as `t2.large`. Or you can change it to another instance type, such as `m5.large`. You might also want to change from a previous generation to a current generation instance type to take advantage of some features, such as support for IPv6.

If you want a recommendation for an instance type that is best able to handle your existing workload, you can use AWS Compute Optimizer. For more information, see [Get EC2 instance recommendations from Compute Optimizer](ec2-instance-recommendations.md).

When you change the instance type, you'll start paying the rate of the new instance type. For the on-demand rates of all instance types, see [Amazon EC2 On-Demand Pricing](https://aws.amazon.com/ec2/pricing/on-demand/).

To add additional storage to your instance without changing the instance type, add an EBS volume to the instance. For more information, see [Attach an Amazon EBS volume to an instance](https://docs.aws.amazon.com/ebs/latest/userguide/ebs-attaching-volume.html) in the *Amazon EBS User Guide*.

## Which instructions to follow?
<a name="choose-instance-resize-instructions"></a>

There are different instructions for changing the instance type. The instructions to use depend on the instance's root volume, and whether the instance type is compatible with the instance's current configuration. For information about how compatibility is determined, see [Compatibility for changing the instance type](resize-limitations.md).

Use the following table to determine which instructions to follow.


| Root volume | Compatibility | Use these instructions | 
| --- | --- | --- | 
| EBS | Compatible | [Change the instance type](change-instance-type-of-ebs-backed-instance.md) | 
| EBS | Not compatible | [Migrate to a new instance type](migrate-instance-configuration.md) | 
| Instance store | Not applicable | [Migrate to a new instance type](migrate-instance-configuration.md) | 

# Compatibility for changing the instance type
<a name="resize-limitations"></a>

You can change the instance type only if the instance's current configuration is compatible with the instance type that you want. If the instance type that you want is not compatible with the instance's current configuration, you must launch a new instance with a configuration that is compatible with the instance type, and then migrate your application to the new instance.

Compatibility is determined through the following:

**Virtualization type**  
Linux AMIs use one of two types of virtualization: paravirtual (PV) or hardware virtual machine (HVM). If an instance was launched from a PV AMI, you can't change to an instance type that is HVM only. For more information, see [Virtualization types](ComponentsAMIs.md#virtualization_types). To check the virtualization type of your instance, check the **Virtualization** value on the details pane of the **Instances** screen in the Amazon EC2 console.

**Architecture**  
AMIs are specific to the architecture of the processor, so you must select an instance type with the same processor architecture as the current instance type. For example:  
+ If the current instance type has a processor based on the Arm architecture, you are limited to the instance types that support a processor based on the Arm architecture, such as C6g and M6g.
+ The following instance types are the only instance types that support 32-bit AMIs: `t2.nano`, `t2.micro`, `t2.small`, `t2.medium`, `c3.large`, `t1.micro`, `m1.small`, `m1.medium`, and `c1.medium`. If you are changing the instance type of a 32-bit instance, you are limited to these instance types.

**Network adapters**  
If you switch from a driver for one network adapter to another, the network adapter settings are reset when the operating system creates the new adapter. To reconfigure the settings, you might need access to a local account with administrator permissions. The following are examples of moving from one network adapter to another:  
+ AWS PV (T2 instances) to Intel 82599 VF (M4 instances)
+ Intel 82599 VF (most M4 instances) to ENA (M5 instances)
+ ENA (M5 instances) to high-bandwidth ENA (M5n instances)

**Enhanced networking**  
Instance types that support [enhanced networking](enhanced-networking.md) require the necessary drivers installed. For example, [Nitro-based instances](instance-types.md#instance-hypervisor-type) require EBS-backed AMIs with the Elastic Network Adapter (ENA) drivers installed. To change from an instance type that does not support enhanced networking to an instance type that supports enhanced networking, you must install the [ENA drivers](enhanced-networking-ena.md) or [ixgbevf drivers](sriov-networking.md) on the instance, as appropriate.  
When you resize an instance with ENA Express enabled, the new instance type must also support ENA Express. For a list of instance types that support ENA Express, see [Supported instance types for ENA Express](ena-express.md#ena-express-supported-instance-types).  
To change from an instance type that supports ENA Express to an instance type that does not support it, ensure that ENA Express is not currently enabled before you resize the instance.

**NVMe**  
EBS volumes are exposed as NVMe block devices on [Nitro-based instances](instance-types.md#instance-hypervisor-type). If you change from an instance type that does not support NVMe to an instance type that supports NVMe, you must first install the NVMe drivers on your instance. Also, the device names for devices that you specify in the block device mapping are renamed using NVMe device names (`/dev/nvme[0-26]n1`).  
[Linux instances] Therefore, to mount file systems at boot time using `/etc/fstab`, you must use UUID/Label instead of device names.

**Volume limit**  
The maximum number of Amazon EBS volumes that you can attach to an instance depends on the instance type and instance size. For more information, see [Amazon EBS volume limits for Amazon EC2 instances](volume_limits.md).  
You can only change to an instance type or instance size that supports the same number or a larger number of volumes than is currently attached to the instance. If you change to an instance type or instance size that does not support the number of currently attached volumes, the request fails. For example, if you change from an `m7i.4xlarge` instance with 32 attached volumes to an `m6i.4xlarge`, which supports a maximum of 27 volumes, the request fails.

**NitroTPM**  
If you launched the instance using an AMI with [NitroTPM](nitrotpm.md) enabled and an instance type that supports NitroTPM, the instance launches with NitroTPM enabled. You can only change to an instance type that also supports NitroTPM.

# Change the instance type for your Amazon EC2 instance
<a name="change-instance-type-of-ebs-backed-instance"></a>

Use the following instructions to change the instance type of an Amazon EBS-backed instance if the instance type that you need is compatible with the current configuration of your instance. For more information, see [Compatibility for changing the instance type](resize-limitations.md).

**Considerations**
+ You must stop your instance before you can change its instance type. Ensure that you plan for downtime while your instance is stopped. Stopping the instance and changing its instance type might take a few minutes, and restarting your instance might take a variable amount of time depending on your application's startup scripts. For more information, see [Stop and start Amazon EC2 instances](Stop_Start.md).
+ When you stop and start an instance, we move the instance to new hardware. If your instance has a public IPv4 address, that is not an Elastic IP, we release the address and give your instance a new public IPv4 address. For more information on IP address behavior throughout the lifecycle of an instance, see [Differences between instance states](ec2-instance-lifecycle.md#lifecycle-differences).
+ You can't change the instance type of a [Spot Instance](using-spot-instances-request.md#stopping-a-spot-instance).
+ [Windows instances] We recommend that you update the AWS PV driver package before changing the instance type. For more information, see [Upgrade PV drivers on EC2 Windows instances](Upgrading_PV_drivers.md).
+ If your instance is in an Auto Scaling group, the Amazon EC2 Auto Scaling service marks the stopped instance as unhealthy, and might terminate it and launch a replacement instance. To prevent this, you can suspend the scaling processes for the group while you're changing the instance type. For more information, see [Suspending and resuming a process for an Auto Scaling group](https://docs.aws.amazon.com/autoscaling/ec2/userguide/as-suspend-resume-processes.html) in the *Amazon EC2 Auto Scaling User Guide*.
+ When you change the instance type of an instance with NVMe instance store volumes, the updated instance might have additional instance store volumes, because all NVMe instance store volumes are available even if they are not specified in the AMI or instance block device mapping. Otherwise, the updated instance has the same number of instance store volumes that you specified when you launched the original instance.
+ The maximum number of Amazon EBS volumes that you can attach to an instance depends on the instance type and instance size. You can't change to an instance type or instance size that does not support the number of volumes that are already attached to your instance. For more information, see [Amazon EBS volume limits for Amazon EC2 instances](volume_limits.md).
+ [Linux instances] You can use the `AWSSupport-MigrateXenToNitroLinux` runbook to migrate compatible Linux instances from a Xen instance type to a Nitro instance type. For more information, see [https://docs.aws.amazon.com/systems-manager-automation-runbooks/latest/userguide/automation-awssupport-migrate-xen-to-nitro.html](https://docs.aws.amazon.com/systems-manager-automation-runbooks/latest/userguide/automation-awssupport-migrate-xen-to-nitro.html) in the *AWS Systems Manager Automation runbook reference*.
+ [Windows instances] For additional guidance on migrating compatible Windows instances from a Xen instance type to a Nitro instance type, see [Migrate to latest generation instance types](migrating-latest-types.md).

**To change the instance type of an Amazon EBS-backed instance**

1. (Optional) If the new instance type requires drivers that are not installed on the existing instance, you must connect to your instance and install the drivers first. For more information, see [Compatibility for changing the instance type](resize-limitations.md).

1. [Windows instances] If you configured your Windows instance to use [static IP addressing](config-windows-multiple-ip.md#step1) and you change from an instance type that doesn't support enhanced networking to an instance type that does support enhanced networking, you might get a warning about a potential IP address conflict when you reconfigure static IP addressing. To prevent this, enable DHCP on the network interface for your instance before you change the instance type. From your instance, open the **Network and Sharing Center**, open **Internet Protocol Version 4 (TCP/IPv4) Properties** for the network interface, and choose **Obtain an IP address automatically**. Change the instance type and reconfigure static IP addressing on the network interface.

1. Open the Amazon EC2 console at [https://console.aws.amazon.com/ec2/](https://console.aws.amazon.com/ec2/).

1. In the navigation pane, choose **Instances**.

1. Select the instance and choose **Instance state**, **Stop instance**. When prompted for confirmation, choose **Stop**. It can take a few minutes for the instance to stop.

1. With the instance still selected, choose **Actions**, **Instance settings**, **Change instance type**. This option is grayed out if the instance state is not `stopped`.

1. On the **Change instance type** page, do the following:

   1. For **Instance type**, select the instance type that you want.

      If the instance type is not in the list, then it's not compatible with the configuration of your instance. Instead, use the following instructions: [Migrate to a new instance type by launching a new EC2 instance](migrate-instance-configuration.md).

   1. (Optional) If the instance type that you selected supports EBS optimization, select **EBS-optimized** to enable EBS optimization, or deselect **EBS-optimized** to disable EBS optimization.

      If the instance type that you selected is EBS optimized by default, **EBS-optimized** is selected and you can't deselect it.

   1. (Optional) Configure vCPU options on the new instance type.

      When you change the instance type of an existing instance, Amazon EC2 applies the CPU option settings from the existing instance to the new instance, if possible. If the new instance type doesn't support those settings, the CPU options are reset to **None**. This option uses the default number of vCPUs for the new instance type.

      If the instance type that you selected supports vCPU configuration, select **Specify CPU options** in the **Advanced details** panel to configure vCPUs for your new instance type.

   1. Choose **Change** to accept the new settings.

1. To start the instance, select the instance and choose **Instance state**, **Start instance**. It can take a few minutes for the instance to enter the `running` state. If your instance won't start, see [Troubleshoot changing the instance type](troubleshoot-change-instance-type.md).

1. [Windows instances] If your instance runs Windows Server 2016 or Windows Server 2019 with EC2Launch v1, connect to your Windows instance and run the following EC2Launch PowerShell script to configure the instance after the instance type is changed.
**Important**  
The administrator password will reset when you enable the initialize instance EC2 Launch script. You can modify the configuration file to disable the administrator password reset by specifying it in the settings for the initialization tasks. For steps on how to disable password reset, see [Configure initialization tasks](ec2launch-config.md#ec2launch-inittasks) (EC2Launch) or [Change settings](ec2launch-v2-settings.md#ec2launch-v2-ui) (EC2Launch v2).

   ```
   PS C:\> C:\ProgramData\Amazon\EC2-Windows\Launch\Scripts\InitializeInstance.ps1 -Schedule
   ```

# Migrate to a new instance type by launching a new EC2 instance
<a name="migrate-instance-configuration"></a>

You can change the instance type of an EC2 instance only if it is an EBS-backed instance with a configuration that is compatible with the new instance type that you want. Otherwise, if the configuration or your instance is not compatible with the new instance type, or it is an instance store-based instance, you must launch a replacement instance that is compatible with the instance type that you want. For more information about how compatibility is determined, see [Compatibility for changing the instance type](resize-limitations.md).

**Overview of the migration process**
+ Back up the data on the original instance.
+ Launch a new instance with a configuration that is compatible with the new instance type that you want, attaching any EBS volumes that were attached to your original instance.
+ Install your application on your new instance.
+ Restore any data.
+ If the original instance has an Elastic IP address, you must associate it with your new instance to ensure that your users can continue to use your application without interruption.

**To migrate an instance to a new instance**

1. Open the Amazon EC2 console at [https://console.aws.amazon.com/ec2/](https://console.aws.amazon.com/ec2/).

1. Back up any data that you still need as follows:
   + Connect to your instance and copy the data on your instance store volumes to persistent storage.
   + [Create snapshots](https://docs.aws.amazon.com/ebs/latest/userguide/ebs-creating-snapshot.html) of your EBS volumes so that you can create new volumes with the same data, or detach the volumes from the original instance so that you can attach them to the new instance.

1. In the navigation pane, choose **Instances**.

1. Choose **Launch instances**. When you configure the instance, do the following:

   1. Select an AMI that supports the instance type that you want. For example, you must select an AMI that supports the processor type of the new instance type. Also, current generation instance types require an HVM AMI.

   1. Select the new instance type that you want. If the instance type that you want isn't available, then it's not compatible with the configuration of the AMI that you selected.

   1. If you want to allow the same traffic to reach the new instance, select the same VPC and security group that are used with the original instance.

   1. When you're done configuring your new instance, complete the steps to select a key pair and launch your instance. It can take a few minutes for the instance to enter the `running` state.

1. If you backed up data to an EBS snapshot, [create a volume from the snapshot](https://docs.aws.amazon.com/ebs/latest/userguide/ebs-creating-volume.html#ebs-create-volume-from-snapshot) and then [attach the volume](https://docs.aws.amazon.com/ebs/latest/userguide/ebs-attaching-volume.html) to the new instance.

   To move an EBS volume from the original instance to the new instance, [detach the volume](https://docs.aws.amazon.com/ebs/latest/userguide/ebs-detaching-volume.html) from the original instance and then [attach the volume](https://docs.aws.amazon.com/ebs/latest/userguide/ebs-attaching-volume.html) to the new instance.

1. Install your application and any required software on the new instance.

1. Restore any data that you backed up from the instance store volumes of the original instance.

1. If the original instance has an Elastic IP address, assign it to the new instance as follows:

   1. In the navigation pane, choose **Elastic IPs**.

   1. Select the Elastic IP address that is associated with the original instance and choose **Actions**, **Disassociate Elastic IP address**. When prompted for confirmation, choose **Disassociate**.

   1. With the Elastic IP address still selected, choose **Actions**, **Associate Elastic IP address**.

   1. For **Resource type**, choose **Instance**.

   1. For **Instance**, choose the new instance.

   1. (Optional) For **Private IP address**, specify a private IP address with which to associate the Elastic IP address.

   1. Choose **Associate**.

1. (Optional) You can terminate the original instance if it's no longer needed. Select the instance, verify that you are about to terminate the original instance and not the new instance (for example, check the name or launch time), and then choose **Instance state**, **Terminate instance**.

# Troubleshoot changing the instance type
<a name="troubleshoot-change-instance-type"></a>

Use the following information to help diagnose and fix issues that you might encounter when changing the instance type.

## Instance won't start after changing instance type
<a name="troubleshoot-change-instance-type-no-start"></a>

**Possible cause: Requirements for new instance type not met**  
If your instance won't boot, it is possible that one of the requirements for the new instance type was not met. For more information, see [Why is my Linux instance not booting after I changed its type?](https://repost.aws/knowledge-center/boot-error-linux-nitro-instance)

**Possible cause: AMI does not support instance type**  
If you use the EC2 console to change the instance type, only the instance types that are supported by the selected AMI are available. However, if you use the AWS CLI to launch an instance, you can specify an incompatible AMI and instance type. If the AMI and instance type are incompatible, the instance can't start. For more information, see [Compatibility for changing the instance type](resize-limitations.md).

**Possible cause: Instance is in cluster placement group**  
If your instance is in a [cluster placement group](placement-strategies.md#placement-groups-cluster) and, after changing the instance type, the instance fails to start, try the following:  

1. Stop all the instances in the cluster placement group.

1. Change the instance type of the affected instance.

1. Start all the instances in the cluster placement group.

## Application or website not reachable from the internet after changing instance type
<a name="troubleshoot-change-instance-type-ipv4"></a>

**Possible cause: Public IPv4 address is released**  
When you change the instance type, you must first stop the instance. When you stop an instance, we release the public IPv4 address and give your instance a new public IPv4 address.  
To retain the public IPv4 address between instance stops and starts, we recommend that you use an Elastic IP address, at no extra cost provided your instance is running. For more information, see [Elastic IP addresses](elastic-ip-addresses-eip.md).