Services

Resources

Company

/

Amazon RDS

Amazon RDS (Relational Database Service)

Amazon RDS (Relational Database Service) runs a relational database for you on AWS. You pick an engine, an instance class and storage, and connect to an endpoint. AWS installs the engine, patches it in a maintenance window, takes backups and, with Multi-AZ, keeps a standby in another Availability Zone for failover. You still own the schema, queries, indexes, parameter settings, connection counts, credentials and when to take a major version upgrade.

How it works

An instance lives in a DB subnet group, a set of private subnets in at least two Availability Zones, and security groups decide who can reach its port. Applications connect with a database user and password, or with AWS IAM database authentication on MySQL and PostgreSQL. Credentials usually live in AWS Secrets Manager, which can rotate them on a schedule through a Lambda function placed in the same VPC subnets as the database.

Backups and replicas solve different problems. Multi-AZ replicates synchronously, so the standby also receives every bad write. Automated backups plus transaction logs, which RDS uploads to Amazon S3 every 5 minutes, give point-in-time restore anywhere inside the retention period of 1 to 35 days.

For example, an orders database keeps backups for 7 days. At 14:32 a migration drops the payments table, and failing over to the standby does not help, because the standby dropped it too. At 14:40 the latest restorable time is 14:37, so the team restores to 14:31 into a new instance. They copy the table back with pg_dump and pg_restore, then replay the 1 minute of payments between 14:31 and 14:32 from application logs. A restore always creates a new instance; it never rewinds the old one in place.

Why it matters in production

Most RDS incidents come from things around the database server: connection exhaustion, storage that fills up, a parameter group change that needs a reboot, a maintenance window nobody noticed, or a restore that was never practised. Test a point-in-time restore before you need one, time it against your RTO and RPO, and keep the master password out of Terraform variables and state where you can.

See also

On the One2N blog

References

  1. What is Amazon Relational Database Service (Amazon RDS)?

  2. Amazon RDS: Restoring a DB instance to a specified time

Diagram of Amazon RDS backups and failover. A migration runs DROP TABLE at 14:32 on the primary database in AZ a. A sync copy arrow sends the same change to the standby in AZ b, which is crossed out in red with the label "dropped it too". The primary also ships logs every 5 minutes and backups kept 7 days to S3, and from S3 a point-in-time restore to 14:31 creates a new instance.