What is the best way to change an instance type that is behind an AWS EC2 load balancer?

Example: change from m3.medium to t2.small.

  • You can't change a PV instance to an HVM instance. You will need to create new HVM instances. Aug 24, 2015 at 17:08

2 Answers 2


if you are using auto-scaling group, just change the launch configuration and kill the load-balanced VMs one by one (wait for the killed machine to be replaced before actually killing all machines)

if you are only using load balancer, change the instance type manually (same as above, one by one). you can change the instance type by right-clicking the instance > instance settings > change instance type (your instance has to be stopped to do so).

Please note that you have some limitations when resizing an instance


By far the fastest way to change an instance type is to write a little script containing AWS CLI commands to stop the instance, change the instance type, and start the instance again.

Replace $instance_id and $instance_type with the correct values and do as follows:

 aws ec2 stop-instances --instance-ids $instance_id 
 aws ec2 modify-instance-attribute --instance-id $instance_id --instance-type $instance_type 
 aws ec2 start-instances --instance-ids $instance_id

You do need to wait for the instance state to change to stopped before changing the type. I wrote this script to handle all of this for me (also takes a snapshot of the stopped instance):


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.