Friday, August 28, 2020

AWS RDS (Relational Database Service)

 AWS RDS [Relational Database Service]:

  1. It is a managed DB service for DB that uses SQL as a query language.

  2. It allows you to create DB in cloud that are managed by AWS

    1. Postgres

    2. MySql

    3. MariaDB

    4. Oracle

    5. Microsoft SQL Server

    6. Aurora (AWS proprietary Service)


Advantages of using RDS over deploying DB on EC2.

  1. Automated provisioning & OS patching

  2. Monitoring dashboards

  3. Continuous backups & restore to specific timestamp (Point in time restore)

  4. Read replicas for improved read performance 

  5. Multi AZ setup for Disaster recovery

  6. Maintenance window for upgrades

  7. Scaling capability (vertical as well as horizontal)

  8. Storage backed by EBS (GP2 or IO1)


Note: But you can’t ssh to the instance.


RDS Backups:

  1. Backups are automatically enabled in RDS.

Automated backups:

  1. Daily full backup of database (during maintenance window).

  2. Transaction logs are backed-up by RDS every 5 mins.

  3. => Above two points gives you the ability to restore at any point in time [from the oldest backup to the last 5 minutes].

  4. 7 days retention period (can be increased up to 35 days).

DB Snapshots:

  • Manually triggered by the user.

  • Retentions of backups for as long as you want.

Read Replicas for read Scalability:

  1. Read replica creates multiple db instances with read access and those async with the master DB instance. 

  2. Eventual read consistency (meaning you won’t get latest output immediately)

  3. Use case:

    1. You have a production database that takes usual normal load

    2. And now you want to run a reporting application to run some analytics.

    3. You create a read replica to run the new workload there

    4. Doing this the production application is unaffected.

    5. Read replicas are used for SELECT (=>READ) only kind of statements. (Not for INSERT, DELETE, UPDATE)

  4. RDS Read Replicas Network costs:

    1. In AWS there is a network cost when the data goes from one AZ to another AZ

    2. To reduce the cost, you can have your Read replica in same AZ.


RDS Multi AZ [Disaster Recovery]:

  1. SYNC REPLICATION

  2. ONE DNS NAME [automatic app failover to standby].

  3. Increase availability.

  4. Failover in case loss of AZ, loss of network, instance or storage failure.

  5. No manual intervention in app.

  6. Stand by becomes master in case of failover.

Note: Not to be used for scaing.

  1. The Read Replicas can be setup as MultiAZ for disaster recovery.


RDS Security & Encryption:

  1. At Rest encryption.

  2. Can encrypt master as well as read replicas using AWS KMS.

  3. Encryption has to be defined during launch time.

  4. If the master is not encrypted the read replica cannot be encrypted. 

  5. Transparent data encryption(TDE) which is available for Oracle & SQL Server.

  6. If flight encryption :

    1. SSL certificate to encrypt data in RDS while in flight.

    2. Provide SSL options with a trust certificate when connecting to the database.

    3. To enforce SSL to users there is explicit parameter for postgres & mysql


Amazon Aurora:

  1. AWS proprietary technology(not open source but)

  2. Postgres & MySql both are supported as Aurora DB that means drivers will works as if Aurora is Postgres or MySql DB.

  3. Aurora is “AWS Cloud Optimized” and claims 5x performance improvement than MYSQL on RDS, over 3X the performance of postgres on RDS.

  4. Aurora storage automatically grows in increments of 10GB, upto 64TB.

  5. Aurora can have 15 replicas while MySql has 5, and the replication process is faster (sub 10ms replica lag).

  6. Failover in Aurora is instantaneous. Its HA by default.

  7. Aurora costs more than 20% of RDS, but it is more efficient. 


Aurora HA & Scaling:


No comments:

Post a Comment

Terraform Cheat Sheet [WIP]

Installing Terraform