# Relational Database Service (RDS)

## Icon

![RDS Icon](https://icon.icepanel.io/AWS/svg/Database/RDS.svg)

## [Introduction](../../../cloudpractitioner/10_database_solutions)

* RDS dont allow access to underlying EC2 instances. So one cannot SSH into the machine running the `RDS`, except when using RDS custom service.

### Features

#### Storage Auto Scaling

* This feature helps in increasing the storage on your DB instance dynamically.
* When this feature is enabled RDS detects when the database is running out of space _(based on threshold value: `Maximum Storage Threshold`)_, will automatically scale the storage.
* No manual intervention is needed for scaling when this feature is enabled.
* `Maximum Storage Threshold` parameter can be configured based on,
  * Percentage of space left.
  * Low storage last for a specific duration.
  * Time passed since last modification.
* Useful for applications with unpredictable workload.
* This feature is available for all RDS database engines.

#### Read Replicas

* When an application is burdened by read and write operation on single node of database then, it is possible that single node may go down becoming _single point of failure_.
* To avoid this, a common strategy is to horizontally scale the database instance to handle reads and writes to separate instances.
* RDS allows upto **15 Read Replicas** to scale the read operation.
* These Read Replicas can be on same AZ, cross AZ or cross-region.
* Replication done is ASYNC, so reads are eventually consistent.
* Replicas can be promoted to their own database when needed, which may allow them to take writes.
* If RDS Read Replication is within same region is free i.e different AZ, cross-region is chargeable.
* More can be read [here](https://aws.amazon.com/rds/features/read-replicas/).

#### Multi AZ

* This feature is used for disaster recovery and not for scaling.
* With this feature, one get a standby instance.
* **One DNS name is associated with both master and stand by instance**.
* This increases availability of the service and provides failover in case of loss of AZ in which master instance resides.
* Read Replicas can be setup as Multi AZ for Disaster Recovery _(DR)_.
* The replication between standby and master instance is synchronous.
* Conversion of Single-AZ database instance to Multi-AZ can be done with zero downtime. Internally, it is basically
  * Taking a snapshot of the DB and restore it in new AZ.
  * Establish synchronization between two instances.
