Amazon RDS
Tags: rds, database, sql
Published: 2022-03-04 13:04:21

**Database as a Service**
*Database Server as a service*

The unit of consumption is a database server that you
have access to.

Can handle multiple SQL Database engines such as
MySQL, MariaDB, PostgreSQL, Oracle, Microsoft Server,
Aurora

Aurora is an engine created by AWS and it has a unique
set of features.

Works by creating an instance

It is accessed through it’s hostname

You can choose from the different instance types and sizes available

An instance can be in a single AZ or multi-AZ.

A single AZ deployment has one attached piece of Block Storage.

Access to the RDS instance is controlled by a security group.

![rds](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/altf20sbo8amah6pr94o.png)

**Multi-AZ**

• No free tier – you pay double the price you pay for a single AZ deployment because the same infrastructure is provisioned in a different AZ.

• Synchronous replication

• Standby CAN’T be directly used. It can never be used to scale reads.

• It is used to improve availability, not performance.

• It makes your instance highly available but not fault tolerant. Failover is between 60 –120 seconds.

• It happens in the SAME region but a different AZ.

• Backups are taken from the standby instance (removes performance impact or disruption).

![rds](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/m8ocnoo0box5gzjrdhnw.png)

**RPO VS RTO**
![rds](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/c69h08ez0tkvwlrmsu1u.png)

**RDS Backups**
• 2 types of backups

• Automated Backups and Manual Snapshots

• Both utilize S3 but they are AWS managed S3 buckets so they won’t be visible to you.

• Snapshots take place on the Standby instance in a Multi-AZ deployment but takes place on the primary instance in a single AZ deployment.

**Manual Snapshots**

• Does not expire
• It exists beyond the lifetime of the RDS instance
• So the user has to go in and clear them

**Automated Backups**

• They are cleaned up automatically
• The retention period is between 0 to 35 days
• In addition to storing the backup, RDS also stores transaction logs which happens every 5 mins.
• Transaction logs store the actual data operations which causes changes within the database
• So can get a 5 mins RPO when using Automated backups
• You can restore an instance using the snapshot and transaction logs within that 35 days period.
• On deletion , you can choose to retain the backup, but I will still be expired based on the retention period or after the 35 days period.

![rds](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/r0egaisg0lrrvqkqs8pg.png)

**Read Replicas**
• Provides both performance and availability improvements
• 5 direct read replicas per instance DB instance
• Replication is done asynchronously
• You can have Read replicas of Read Replicas but then, lag becomes a problem.
• Global performance improvements using Cross region read replicas.
• Snapshots/ Backups Improve RPO but RTOs are still a problem
• Restores of backups take time.
• Read replicas offer a near zero RTO
• Read replicas can be promoted immediately when the primary database fails.
• This happens only when the Primary database fails. READ ONLY UNTIL PROMOTED.
• Global availability improvements and resilience Cross region read replicas.

**RDS Security**
• Encryption is handled in 2 main ways
• Encryption handled by the RDS host
• Encryption handled by the DB engine; Transparent Data Encryption(TDE)
• Both can use KMS for Keys
• RDS Oracle and MySQL support TDE
• Oracle TDE supports integration CloudHSM

 ![rds](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/be5ag2szut3mly4awxrl.png)