Skip to content

RDS Backups, Multi-AZ, and Read Replicas

RDS Backups

There are two types of backups for AWS: Automated Backups and Database Snapshots.

Automated Backups

Automated Backups allow you to recover your database to any point in time within a retention period. The retention period can be between 1 and 35 days. Automated Backups will take a full daily snapshot and will also store transaction logs throughout the day. When you do a recovery, AWS will first choose the most recent daily backup and then apply transaction logs relevant to that day. This allows you to do a point in time recovery down to the second, within the retention period.

Automated Backups are enabled by default. The backup data is stored in S3 and you get free storage space equal to the size of your database. So if you have an RDS instance of 10 GB, you will get 10 GB worth of free storage space.

Backups are taken within a defined window. During the backup window, storage I/O may be suspended while your data is being backed up and you may experience elevated latency.

Database Snapshots

Database Snapshots are done manually (i.e. they are user-initiated). They are stored even after you delete the original RDS instance, unlike automated backups.

Restoring Backups

Whenever you restore either an Automated Backup or a manual Snapshot, the restored version of the database will be a new RDS instance with a new DNS endpoint.

For example: original.us-east-1.rds.amazonaws.com -> restored.us-east-1.rds.amazonaws.com

Encryption

Encryption-at-rest is supported for MySQL, Oracle, SQL Server, PostgreSQL, MariaDB, and Aurora. Encryption is done using the AWS Key Management Service (KMS) service. Once your RDS instance is encrypted, the data stored at rest in the underlying storage is encrypted, as are its automated backups, read replicas, and snapshots.

At present time, encrypting an existing DB instance is not supported. To use Amazon RDS encryption for an existing database, you must first create a snapshot, make a copy of that snapshot and encrypt the copy.

Multi-AZ

Multi-AZ allows you to have an exact copy of your production database in another AZ. AWS handles the replication for you, so when your production database is written to, this write will automatically be synchronized to the stand-by database.

In the event of planned database maintenance, DB instance failure, or an AZ failure, RDS will automatically failover to the stand-by so that database operations can resume quickly without administrative intervention.

For disaster recovery purposes, a database that's in us-east-1A will automatically replicate over to us-east-1b. The important thing about this to understand is that you don't deal with IP addresses for this reason. If us-east-1a fails, AWS automatically switches over to us-east-1b. Since there's no explicit IP address being referenced in your code (but a DNS instead), the switch is seamless from the application's perspective.

It is important to understand that multi-AZ is for disaster recovery only. It is not for performance improvements. For improving performance, you need read replicas.

Multi-AZ Databases

  • SQL Server
  • Oracle
  • MySQL
  • PostgreSQL
  • MariaDB

Read Replicas

Read replicas allow you to have a read-only copy of your production database. This is achieved by using Asynchronous replication from the primary RDS instance to the read replica. You use read replicas primarily for very read-heavy database workloads.

  • Used for scaling, not disaster recovery.
  • Must have automatic backups turned on in order to deploy a read replica.
  • You can have up to 5 read replica copies of any database.
  • You can have read replicas of read replicas (but watch out foor latency).
  • Each read replica will have its own DNS endpoint.
  • You can have read replicas that have Multi-AZ.
  • You can create read replicas of Multi-AZ source databases.
  • Read replicas can be promoted to be their own databases. This rbeaks the replication.
  • You can have a read replica in a second region.

Read Replica Databases

  • MySQL
  • PostgreSQL
  • MariaDB
  • Aurora

It is not available for MS SQL Server or Oracle at this time.