Command Palette

Search for a command to run...

Hectal
PHASE 4Intermediate ~13 min· topic 3 of 4

Topic 4.3

RDS & Aurora: Managed Relational Databases

In one line

RDS runs Postgres/MySQL and others for you with automated backups, patching, and Multi-AZ failover; read replicas scale reads; Aurora is AWS's re-engineered, cluster-based variant with shared storage and faster failover.

0/4 · 0%

Think of it like this

Running your own database on EC2 is owning a car and doing all your own servicing. RDS is a lease with a maintenance package — backups, patches, and a standby spare car handled for you — while you still decide where to drive (schema, queries, indexes).

Key ideas

  1. 01

    RDS manages provisioning, OS and engine patching, automated daily backups with POINT-IN-TIME RECOVERY (to any second within the retention window, up to 35 days), monitoring, and storage autoscaling. You don't get OS access; you manage schema, queries, parameters, and users.

  2. 02

    MULTI-AZ is for AVAILABILITY: a synchronous standby in another AZ; on failure or maintenance, RDS flips the DNS endpoint to the standby (typically 1–2 minutes). The classic standby isn't readable. Always enable it for production.

  3. 03

    READ REPLICAS are for SCALING READS: asynchronous copies (same or cross-region) with their own endpoints. Because replication is async, a read right after a write may return stale data — route read-your-own-writes paths to the primary.

  4. 04

    AURORA separates compute from a shared storage layer replicated 6 ways across 3 AZs. Replicas read the same storage (low lag, up to 15), failover is usually under 30 seconds, and there's a single READER endpoint load-balancing across replicas. Aurora Serverless v2 scales capacity in fine-grained increments for spiky workloads.

  5. 05

    CONNECTIONS are a real limit: each connection costs database memory, and many app instances or Lambda functions can exhaust max_connections. Use a pool in the app and RDS PROXY in front of the database for serverless or bursty clients. Put databases in private data subnets with security groups allowing only the app tier, and prefer IAM auth or Secrets Manager with rotation over hardcoded passwords.

Code & diagrams

rds.shbash
aws rds create-db-subnet-group --db-subnet-group-name prod-data \
  --db-subnet-group-description "private data subnets" \
  --subnet-ids $DATA_A $DATA_B

aws rds create-db-instance --db-instance-identifier orders-prod \
  --engine postgres --engine-version 16.4 --db-instance-class db.m7g.large \
  --allocated-storage 100 --storage-type gp3 --max-allocated-storage 500 \
  --multi-az --storage-encrypted --no-publicly-accessible \
  --db-subnet-group-name prod-data --vpc-security-group-ids $SG_DB \
  --master-username app --manage-master-user-password \
  --backup-retention-period 14 --deletion-protection

# Read replica for reporting traffic
aws rds create-db-instance-read-replica --db-instance-identifier orders-reporting \
  --source-db-instance-identifier orders-prod

# Point-in-time restore creates a NEW instance — the original is untouched
aws rds restore-db-instance-to-point-in-time \
  --source-db-instance-identifier orders-prod \
  --target-db-instance-identifier orders-restore-0915 \
  --restore-time 2026-09-15T10:42:00Z
MultiAzVsReplicadiagram
Rendering diagram…

Explain it without notes

01

What's the difference between Multi-AZ and a read replica? Can one replace the other?

02

A user updates their profile and the next page shows the old name. The app reads from a replica. Explain and fix.

Practice

01

Someone ran a bad UPDATE without a WHERE at 10:43. How do you recover with RDS?

02

200 Lambda concurrent invocations each open a Postgres connection and the database starts refusing connections. What do you do?

Trade-offs

  • ↔

    Aurora gives faster failover, more replicas with lower lag, and storage that grows automatically, but costs more than standard RDS for steady small workloads and adds I/O pricing considerations; standard RDS Postgres/MySQL is simpler and cheaper when its limits aren't a problem.

Done when you can

  • I enable Multi-AZ, encryption, backups, and deletion protection for production databases.

  • I know the difference between Multi-AZ standbys and read replicas.

  • I can perform a point-in-time restore.

  • I manage connection limits with pooling and RDS Proxy.