I want to know what happens when I change my Amazon Relational Database Service (Amazon RDS) DB instance from a Single-AZ to a Multi-AZ deployment. Or, I want to know what happens when I change my instance from a Multi-AZ to a Single-AZ deployment.
Resolution
Choose the deployment type for your use case
Before you change your deployment type, review the following differences between Multi-AZ and Single-AZ deployments:
- A Single-AZ configuration deploys an RDS DB instance and Amazon Elastic Block Store (Amazon EBS) storage volumes in one Availability Zone.
- A Multi-AZ configuration deploys an instance and EBS storage volumes across two Availability Zones.
- When you use Multi-AZ deployment, Amazon RDS maintains a standby copy of your data. Amazon RDS detects and then automatically recovers from infrastructure failures so that you can quickly resume database operations.
- When you use Single-AZ deployment, you might have to initiate a point-in-time-recovery (PITR) operation during a planned or unplanned outage. A PITR operation can take several hours to complete. Data updates that occur after the latest restorable time aren't available, so you might experience additional downtime.
- For a Multi-AZ deployment, Amazon RDS creates DB snapshots and automated backups from the secondary instance during the automatic backup window. The backup process doesn't suspend I/O activity on your primary instance because Amazon RDS takes the backup from the secondary instance for Amazon RDS for MariaDB, Amazon RDS for MySQL, Amazon RDS for Oracle, and Amazon RDS for PostgreSQL database engines. For Amazon RDS for SQL Server, the backup process briefly suspends I/O activity.
- In a Single-AZ deployment, the backup process results in a brief I/O suspension that can last from a few seconds to a few minutes. The amount of time depends on the size and class of your instance.
- For Multi-AZ deployments, Amazon RDS applies operating system (OS) maintenance and scaling operations to the secondary instance first. Amazon RDS promotes the secondary instance to the primary instance, and then performs maintenance or modifications on the old primary instance. The old primary instance becomes the new standby instance. So, there's minimal downtime during certain OS patches or scaling operations.
- A Single-AZ instance is unavailable during a scaling operation.
Note: You don't experience downtime on the instance when you change from one deployment type to another.
Modify your deployment type from Multi-AZ to Single-AZ
Modify your deployment type.
When you change your instance from a Multi-AZ deployment to a Single-AZ deployment, Amazon RDS deletes only the secondary instance and volumes. The modification doesn't affect the primary instance.
Modify your deployment type from Single-AZ to Multi-AZ
Modify your deployment type.
When you change your instance from a Single-AZ deployment to a Multi-AZ deployment, Amazon RDS creates a snapshot of the instance's volumes. Amazon RDS uses the snapshot to create new volumes in another Availability Zone. The new volumes are immediately available for use.
However, you might experience increased write latency during and after the modification process because of lazy loading. This occurs because the instance is loading the new volume's data from Amazon Simple Storage Service (Amazon S3) in the background. For more information, see Restoring to a DB instance.
The amount of latency that you experience is based on your volume type, workload, instance, and volume size. As a result, it's a best practice to modify a test instance before you modify the production instance. It's also a best practice to modify the instance in a maintenance or low-throughput window.
To reduce load duration and write latency, complete the following steps:
- Change the instance's storage type to Provisioned input/output operations per second (IOPS). Provision an amount of IOPS that's much higher than your workload requires.
Note: If the instance uses a custom parameter group, then downtime can occur when you change the storage type.
- If you didn't change the deployment type, then modify the instance to a Multi-AZ deployment.
- Initiate a failover on your instance to make sure that the new Availability Zone is the primary Availability Zone.
- Run a full dump of the data on your instance. Or, run full table scan queries on the most active tables to quickly load the data into the volumes.
- Review the WriteLatency metric in Amazon CloudWatch to confirm that the write latency returns to normal levels.
- Change back the instance's storage type or IOPS to your previous configuration.
Note: Downtime doesn't occur when you change back your storage type.
When you change an instance from a Single-AZ deployment to a Multi-AZ deployment, Amazon RDS creates a standby instance with the same configuration in another Availability Zone. The standby instance can incur additional costs. Also, because a Multi-AZ deployment uses synchronous replication, writes are slightly slower than those in a Single-AZ deployment.
Related information
Amazon RDS Multi-AZ