Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change AWS-RDS instance type without downtime?

I'm using AWS-RDS(Aurora MySQL5.6) and It's a cluster, it has one writer instance and one reader instance. I find each instance would be down for nearly 10 minutes when I change its type, it's unacceptable, what should I do to avoid downtime?

Here are more details information:

  • Change type from db.t2.small to db.t2.medium
  • Engine version: 5.6.10a
  • Freeable Memory: 300M
  • DB Connections (Count): ~400
  • CPU Utilization (Percent): ~20%
like image 398
troy Avatar asked Feb 15 '19 11:02

troy


People also ask

Can you change RDS instance type?

You can apply the change immediately or during the maintenance window specified for the instance. Storage and instance type are decoupled. Also, modifying your storage doesn't incur any downtime.

Does increasing RDS storage require downtime?

In most cases, scaling storage doesn't require any outage and doesn't degrade performance of the server. After you modify the storage IOPS for a DB instance, the status of the DB instance is storage-optimization. Storage optimization can take several hours.

How long does it take to upgrade RDS instance type?

The instance upgrade on the slave usually takes around 10 to 20 minutes, but there is no downtime in this setup.


1 Answers

Instead of changing the type of the current writer instance, add a new writer with the desired instance type:

  1. Add an Aurora reader with the desired new instance type (for example db.t2.medium) to the cluster. Be sure to assign the reader the best priority so that it will be promoted to writer during failover (see Aurora Documentation for more in-depth information).
  2. Wait until the new instance is up and running.
  3. Then failover the cluster so that the new reader gets promoted to a writer.
  4. Finally delete the previous Aurora instance of the old instance type.

This way you will have nearly no downtime.

If you want to change the type of a reader instance:

  1. Add an Aurora reader with the desired new instance type.
  2. Wait until it's up and running.
  3. Delete the previous reader instance.
like image 69
Stefan Avatar answered Sep 29 '22 05:09

Stefan