RDS - Backups, Multi-AZ & Read Replicas
There are two different types of Backups for AWS: Automated Backups and Database snapshots.
Automated Backups allow you to recover your database to any point in time within a “retention period”. The retention period can be between one 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 a 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 10Gb, you will get 10Gb worth of storage.
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.
- DB Snapshots are done manually (ie they are user initiated.) They are stored even after you delete the original RDS instance, unlike automated 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.
Encryption at rest is supported for MySQL, Oracle, SQL Server, PostgreSQL, MariaDB & 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 the present time, encrypted 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.
Disaster Recovery only. It is not used for performance improvement.
Read Replicas are for performance.
Exact copy of prod database in another AZ. AWS handles replication for you, so when your production database is written to, this write will automatically be synchronized to the standby database.
In the event of planned database maintenance, DB instance failure, or an AZ failure, RDS will automatically failover to the standby so that database operations can resume quickly without admin intervention.
- SQL Server
Read only copy of your prod 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 db workloads.
- Read Replicas used for scaling, not DR
- 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 for latency.)
- Each read replica will have its own DNS end point.
- 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 their own databases. This breaks the replication.
- You can have a read replica in another region.