RDS allows you to
create databases in the cloud that are managed by AWS
Advantages over using RDS versus deploying DB on EC2
what you can’t do with RDS as opposed to deploying DB on EC2
you can’t SSH into your instances
RDS Backups
2. Automated backups and / or DB Snapshots
RDS Automated backups
DB shapshots
2. retention of backup for as long as you want
if you want to speed up reads from your RDS DB instance
You can reduce the load on your primary DB instance by routing read queries from your applications to the read replica.
You can elastically scale out beyond the capacity constraints of a single DB instance for read-heavy database workloads.
RDS Read Replicas how many
up to 5 read replicas
RDS Read Replicas and AZ
can be
Replication is
ASYNC, so reads are eventually consistent
Replica Lag
Each Read Replica publishes a Replica Lag metric in Amazon CloudWatch to allow you to see how far it has fallen behind the source DB Instance.
how to deal with eventual consistency
DO NOT send SELECT queries to a read slave if the data needs to be immediately available.
You should structure your application such that all real-time requests hit your master, and all other requests hit one of your read slaves.
For things where you don’t need real-time results, you can fool the user quite well using something like AJAX requests or websockets (websockets is going to make your application a lot more resource friendly as you won’t be hammering your backend servers with multiple AJAX requests).
why would you promote a replica to stand-alone DB?
You can use read replica promotion as a data recovery scheme if the primary DB instance fails.
But be aware of the ramifications and limitations of asynchronous replication.
To promote a replica for data recovery
In the event of a failure, do the following:
Replica traffic
The primary DB instance is the only copy of the database that can accept both read/write traffic; the read replica can only accept read-only traffic.
use case for RDS read replica
you have a production database taking on a normal load
you want to a reporting application to run some analytics
In order to avoid extra load on the main database, you create a read replica and run this new workload on it
Network costs
if your main database is in one AZ and your replica - in another one - there will be a network cost for ASYNC replication of the data. Because when the data is transfered between AZs - there is always a price to pay
So to reduce the costs we can place both the main DB and the replica in one AZ, then we are not charged for the transfer
RDS Mutli AZ purpose
disaster recovery in cases of
increase availability
but NOT for scalability
RDS Mutli AZ one DNS name
we have a synchronous replica in another AZ. Automatic failover: App is automatically recovered from failure by redirecting traffic to the standby replica.
no manual intervention necessary
RDS Multi AZ and replicas
read replicas can be set up as Multi AZ for Disaster Recovery
2 types of RDS encryption
2. in-flight encryption
at rest encryption
you can use AWS KMS customer master key (CMK) which is AES-256 encryption (symmetric block)
has to be configured at launch time
You don’t need to modify your database client applications to use encryption. Amazon RDS handles authentication of access and decryption of your data transparently with a minimal impact on performance.
at rest encryption - if master not encrypted
read replicas cannot be encrypted
TDE
Transparent Data Encryption is avaialble for Oracle and SQL Server
using TDE and encryption at rest simultaneously might slightly affect the performance of your database. You must manage different keys for each encryption method.