4

My AWS reserved instance t2.micro is going to expire. I decided to upgrade to t2.small, and have just bought a new reserved instance t2.small, as shown below.

enter image description here

Now, how do I switch from t2.micro to t2.small?

SparkAndShine
  • 17,001
  • 22
  • 90
  • 134
  • Resize it per http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-resize.html. If it has an Elastic IP, then simply associate that EIP with the new instance. – jarmod Apr 29 '17 at 00:32

4 Answers4

6

As I didn't change the instance type (T2), here is what I do.

  • Purchase a new reserved instance, t2.small
  • Stop instance (t2.micro):Instances --> Actions --> Instance State --> Stop
  • Change Instance Type:Instances --> Instance Settings --> Change Instance Type --> t2.small
  • Start instance (t2.small):Actions --> Instance State --> Start
SparkAndShine
  • 17,001
  • 22
  • 90
  • 134
  • Just a warning to anyone trying this: you will lose your public-facing IPv4 Public IP, and you will have to redo all your DNS records! I don't know if there is any way around this. – Jonathan Apr 13 '18 at 18:35
  • @Jonathan - Will public IP change? are you sure? – 151291 Sep 25 '18 at 13:13
  • @151291 I am positive that it was the case in April because I did it. You need to have an elastic IP that points to your EC2 instance if you want to avoid that, but if you already have domains pointing to EC2 IP you would have to re-point them to the elastic IP. – Jonathan Sep 25 '18 at 13:23
  • Do we lose any data ? – Lakin Mohapatra Dec 17 '18 at 12:59
5

Please note that a Reserved Instance is a pricing discount. It does not apply to a specific instance.

By purchasing a t1.micro reserved instance (RI), one instance matching the specification (Instance Type + Operating system + optional AZ) can run every hour during the RI period at no charge (because you have paid for it up-front, either annual or monthly).

The only 'danger' of going past your RI expiry is that the instance will be charged the standard hourly On-Demand rate (about 1.2c/hour for Linux instances). Similarly, the only 'danger' of using a t2.small prior is being charged the hourly rate of 3.2c/hour.

Therefore, if you can survive the instance being offline for a few minutes, simply:

  • Stop the instance
  • Change the instance type
  • Start it again

It doesn't matter if you don't do it at the perfect time... you'll just be charged a few cents.

Further, if your new Reserved Instance is regional (meaning that no Availability Zone has been selected), then you can take advantage of Instance Size Flexibility. This is best understood by example:

  • You have an RI for a t1.micro
  • You are running a t1.small
  • The micro is half the size of the small (in terms of CPU & RAM)
  • Therefore, the RI covers half the cost of the instance, and you only pay the other half

So, if your new RI is regional, it doesn't matter if you change the instance size late. Your t2.small RI will actually cover the cost of the t2.micro instance (and could actually cover the cost of 2 x t2.micro instances).

Bottom line: Change your instance type whenever you want. The cost of getting the timing wrong is negligible.

John Rotenstein
  • 241,921
  • 22
  • 380
  • 470
4

One strategy would be to take an image snapshot of your micro instance and use it for the small instance.

First, make a backup.

  1. Open the context menu (right click) on your running instance in your Instances pane.
  2. Choose Image -> Create Image.
  3. You'll eventually have a new AMI in the AMIs pane.
  4. When you are making the switch, use this new AMI to launch the instance (select the AMI and Launch).

You'll need to stop one instance and start the other at the appropriate time. Either write a script that uses the AWS SDK in the language of your choice, or do it manually.

Don't forget about DNS and IP addresses with respect to making the switch, and that you'll have downtime unless you have some overlap. I would recommend you leave micro running while you start the small and change your routing etc.

h4xnoodle
  • 1,038
  • 1
  • 11
  • 14
  • Thx. Is it possible to keep elastic IP unchanged? – SparkAndShine Apr 29 '17 at 00:08
  • 1
    Yes, you can keep the elastic IP unchanged, but you will need to disassociate it from the old instance, and then associate it with the new one. When ssh'ing into your new instance, don't forget to remove the reference to the the IP from the list of known hosts, or you will get an error when trying to ssh into your new instance. – ciara staggs Jan 03 '19 at 20:48
0

This solution will work, but it will reset the Public IP. Which will then need to be updated on Route 53, in order to make the site work again. And any other place the public IP has been used.

  1. Stop the instance: Instances --> Actions --> Instance State --> Stop
  2. Change Instance Type: Instances --> Instance Settings --> Change Instance Type
  3. Start the instance again: Actions --> Instance State --> Start