A better way to change the size of your instance on Amazon EC2. #geekish

Let’s say you have a micro instance on Amazon and you want to make it bigger, either because it is too slow or you don’t have enough memory. You want to change it from a micro instance to a small instance.

One way to do this is to stop the instance and then right click on it and select the action: change instance type. If you see the new size you want, you can select it and then start the server.

However, that won’t work for all instance types. (For example, if you want to go from an m1.medium to an m1.large). In those cases, try the following approach. First, create the small instance. Make sure it is in the same zone as the micro instance. Indeed, try to keep as much the same as possible, including using the same AMI ID, security groups, key pair names, etc.

Second, once it is up and available, write down the instance and the instance ID and the volume IDs of all the volumes attached to the old (micro) instance and the new (small) instance. Also note how each volume is attached to the instance.
Third, stop both instances
Fourth, detach all the volumes from the small and the micro instance.
Fifth, attach the micro volumes to the small instance and the small volumes to the micro instance. In effect, you are swapping the volumes of two instances. Make sure you attach them properly.
Sixth, start the small instance and the login to the instance to make sure all the volume are attached properly and operational. Start up any processes or software you need on the new small instance and make sure it is working properly.
Seventh, if things are not working, stop the instance and swap the volumes back. If things are working, after a period of time, you can delete the old instance. Make sure the volume associated with it is gone too.

Finally, the other way to do this is create a small instance and then set it up the way you did the micro instance.

4 responses to “A better way to change the size of your instance on Amazon EC2. #geekish

  1. I know I’m missing something, but why can’t you just stop the micro, right-click on it in the EC2 console and select “Change Instance Type”. Select “Small” or whatever size you need and then re-start the instance.

    • smartpeopleiknow

      Doh! It is ME who is missing something. I either didn’t see that or saw that it was grayed out (because the instance was running). So many thanks!! (P.S. This is why it is good to share things: you learn that you are doing things wrong.)

  2. smartpeopleiknow

    Update: what Sean says is true in some instances. But, for example, if you want to go from an m1.medium to an m1.large, you cannot do it by Change Instance type.

    • Not sure I follow. We do this all the time (we go from small to large, medium to large, xlarge, etc, etc, etc).

      Never had any problem with stopping an instance and changing it to anything we need at the time. For giggles, I just went and changed an m1.small to hs1.8xlarge with no problems.