How to change AWS-RDS instance type without downtime?

troy picture troy · Feb 15, 2019 · Viewed 7.6k times · Source

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%

Answer

Stefan picture Stefan · Feb 15, 2019

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.