Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China.
Change the instance type
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 Amazon Compute Optimizer. For more information, see Get recommendations for an instance type.
Which instructions to follow?
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.
Use the following table to determine which instructions to follow.
Considerations for compatible instance types
Consider the following when changing the instance type of an existing instance:
-
You must stop your Amazon EBS-backed 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 your instance.
-
When you stop and start an instance, we move the instance to new hardware.
If your instance has a public IPv4 address, we release the address and give your
instance a new public IPv4 address. If you require a public IPv4 address that
does not change, use an Elastic IP
address.
-
You can't change the instance type if hibernation
is enabled for the instance.
-
You can't change the instance type of a Spot Instance.
-
If your instance is in an Auto Scaling group, the Amazon EC2 Auto Scaling service marks the stopped
instance as unhealthy, and may 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 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.
Change the instance type of an existing EBS-backed instance
Use the following instructions to change the instance type of an EBS-backed instance if
the instance type that you need is compatible with the instance's current configuration.
- New console
-
To change the instance type of an Amazon EBS-backed instance
-
(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.
-
Open the Amazon EC2 console at
https://console.amazonaws.cn/ec2/.
-
In the navigation pane, choose Instances.
-
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.
-
With the instance still selected, choose Actions,
Instance settings, Change instance
type. This option is grayed out if the instance state is not
stopped
.
-
On the Change instance type page, do the following:
-
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: Change the instance type by launching a new instance.
-
(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.
-
Choose Apply to accept the new settings.
-
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.
- Old console
-
To change the instance type of an Amazon EBS-backed instance
-
(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.
-
Open the Amazon EC2 console.
-
In the navigation pane, choose Instances.
-
Select the instance and choose Actions, Instance
State, Stop. When prompted for confirmation,
choose Yes, Stop.
It can take a few minutes for the instance to stop.
-
With the instance still selected, choose Actions,
Instance Settings, Change Instance Type.
This action is grayed out if the instance state is not stopped
.
-
In the Change Instance Type dialog box, do the following:
-
From Instance Type, select the instance type that you
want.
If the instance type that you want does not appear in the list, then it is
not compatible with the configuration of your instance. Instead, use the
following instructions: Change the instance type by launching a new instance.
-
(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.
-
Choose Apply to accept the new settings.
-
To restart the stopped instance, select the instance and choose
Actions, Instance State,
Start.
-
In the confirmation dialog box, choose Yes, Start. 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.
Change the instance type by launching a new instance
If the current configuration of your EBS-backed instance is incompatible with the new
instance type that you want, then you can't change the instance type of the original instance.
Instead, you must launch a new instance with a configuration that is compatible with the new
instance type that you want, and then migrate your application to the new instance. For example, if you launched your original instance from a PV AMI, but want to
change to a current generation instance type that is only supported by an HVM AMI, you'll
need to launch a new instance from an HVM AMI. For information about how
compatibility is determined, see Compatibility for changing the instance type.
To migrate your application to a new instance, do the following:
-
Back up the data on your original instance.
-
Launch a new instance with a configuration that is compatible with the new instance
type that you want, and attach any EBS volumes that were attached to your original
instance.
-
Install your application and any software on your new instance.
-
Restore any data.
-
If your original instance has an Elastic IP address, and you want to ensure that
your users can continue uninterrupted to use the applications on your new instance, you
must associate the Elastic IP address with your new instance. For more information, see
Elastic IP address.
- New console
-
To change the instance type for a new instance configuration
Open the Amazon EC2 console at
https://console.amazonaws.cn/ec2/.
-
Back up data that you need to keep, as follows:
-
In the navigation pane, choose Instances.
-
Choose Launch instances. When you configure the instance,
do the following:
-
Select an AMI that will support the instance type that you want. Note that
current generation instance types require an HVM AMI.
-
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.
-
If you're using an Elastic IP address, select the VPC that the original
instance is currently running in.
-
If you want to allow the same traffic to reach the new instance, select
the security group that is associated with the original instance.
-
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.
-
If required, attach any new EBS volumes based on the snapshots that you
created, or any EBS volumes that you detached from the original instance, to the
new instance.
-
Install your application and any required software on the new instance.
-
Restore any data that you backed up from the instance store volumes of the
original instance.
-
If you are using an Elastic IP address, assign it to the new instance as
follows:
-
In the navigation pane, choose Elastic IPs.
-
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.
-
With the Elastic IP address still selected, choose
Actions, Associate Elastic IP
address.
-
For Resource type, choose
Instance.
-
For Instance, choose the new instance with which to
associate the Elastic IP address.
-
(Optional) For Private IP address, specify a private
IP address with which to associate the Elastic IP address.
-
Choose Associate.
-
(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.
- Old console
-
To migrate your application to a compatible instance
-
Back up any data on your instance store volumes that you need to keep to
persistent storage. To migrate data on your EBS volumes that you need to keep,
create a snapshot of the volumes (see Create Amazon EBS snapshots) or detach the volume from the instance
so that you can attach it to the new instance later (see Detach an Amazon EBS volume from a Linux
instance).
-
Launch a new instance, selecting the following:
-
An HVM AMI.
-
The HVM only instance type.
-
If you are using an Elastic IP address, select the VPC that the original
instance is currently running in.
-
Any EBS volumes that you detached from the original instance and want to
attach to the new instance, or new EBS volumes based on the snapshots that you
created.
-
If you want to allow the same traffic to reach the new instance, select
the security group that is associated with the original instance.
-
Install your application and any required software on the instance.
-
Restore any data that you backed up from the instance store volumes of the
original instance.
-
If you are using an Elastic IP address, assign it to the newly launched
instance as follows:
-
In the navigation pane, choose Elastic IPs.
-
Select the Elastic IP address that is associated with the original
instance and choose Actions, Disassociate
address. When prompted for confirmation, choose
Disassociate address.
-
With the Elastic IP address still selected, choose
Actions, Associate address.
-
From Instance, select the new instance, and then
choose Associate.
-
(Optional) You can terminate the original instance if it's no longer needed.
Select the instance and verify that you are about to terminate the original
instance, not the new instance (for example, check the name or launch time).
Choose Actions, Instance State,
Terminate.