Amazon RDS

RDS is managed relational database hosting — AWS handles patching, backups and replication of engines like MySQL and PostgreSQL.

Amazon RDS (Relational Database Service) runs managed relational databases so you skip the operational chores of installing, patching, backing up and replicating a database server.

Supported engines

  • MySQL, MariaDB, PostgreSQL
  • Oracle and SQL Server
  • Amazon Aurora — AWS's own MySQL- and PostgreSQL-compatible engine, built for the cloud.

Features you get for free

  • Automated backups and point-in-time recovery.
  • Multi-AZ deployments — a standby replica in another AZ for automatic failover.
  • Read replicas — offload read-heavy traffic.
  • Encryption at rest and in transit.

Place RDS in a private subnet and let only your application security group reach it.

Example

Example · bash
# Launch a managed PostgreSQL instance with Multi-AZ failover
aws rds create-db-instance \
  --db-instance-identifier app-db \
  --engine postgres \
  --db-instance-class db.t3.micro \
  --allocated-storage 20 \
  --master-username appadmin \
  --master-user-password 'REPLACE_WITH_SECRET' \
  --multi-az \
  --vpc-security-group-ids sg-0123456789abcdef0 \
  --db-subnet-group-name app-db-subnets

When to use it

  • A SaaS application runs its relational data on RDS PostgreSQL with Multi-AZ enabled so the database automatically fails over to a standby replica during maintenance.
  • A startup uses RDS MySQL with automated backups so they can restore to any point in time within the last 7 days if a bad migration corrupts data.
  • A read-heavy application adds RDS Read Replicas to distribute SELECT queries across multiple instances, reducing load on the primary.

More examples

Create an RDS MySQL Instance

Creates a t3.micro MySQL 8.0 RDS instance with 7-day automated backups and no public internet access.

Example · bash
aws rds create-db-instance \
  --db-instance-identifier my-mysql-db \
  --db-instance-class db.t3.micro \
  --engine mysql \
  --engine-version 8.0 \
  --master-username admin \
  --master-user-password MySecretPass123! \
  --allocated-storage 20 \
  --backup-retention-period 7 \
  --no-publicly-accessible

Create a Read Replica

Creates a read replica of the primary RDS instance to offload read queries and improve application throughput.

Example · bash
aws rds create-db-instance-read-replica \
  --db-instance-identifier my-mysql-db-replica \
  --source-db-instance-identifier my-mysql-db \
  --db-instance-class db.t3.micro

Restore DB to Point in Time

Restores an RDS instance to a specific timestamp, enabling recovery from accidental data changes or failed migrations.

Example · bash
aws rds restore-db-instance-to-point-in-time \
  --source-db-instance-identifier my-mysql-db \
  --target-db-instance-identifier my-mysql-db-restored \
  --restore-time 2024-01-15T03:00:00Z \
  --db-instance-class db.t3.micro

Discussion

  • Be the first to comment on this lesson.
Amazon RDS — AWS | SoundsCode