SkillSprout
Chapter 7 · Lesson 1
Intermediate
8 min read

RDS

Overview

Amazon Relational Database Service (RDS) is a managed service for running relational (SQL) databases in the cloud. You choose an engine, an instance size and storage, and AWS handles provisioning, operating-system and engine patching, automated backups, monitoring and failover. You keep control of the schema, queries and tuning, but never SSH into the server (apart from the RDS Custom variants).

RDS supports MySQL, MariaDB, PostgreSQL, Oracle, Microsoft SQL Server, IBM Db2 and Amazon Aurora. Databases run inside your VPC on EC2-like DB instances backed by EBS storage, and applications connect through a DNS endpoint rather than an IP address, which is what allows transparent failover.

Two features are central to the exam and easy to confuse: Multi-AZ is for high availability (a synchronous standby you cannot read from in the classic setup), while Read Replicas are for read scaling (asynchronous copies you can query). Knowing which to apply to which requirement wins many questions.

Key Concepts

  • RDS is a managed relational database: AWS handles patching, backups, failover and hardware; you cannot access the underlying OS (except RDS Custom).
  • Multi-AZ instance deployment keeps a synchronous standby in another AZ and fails over automatically (typically 60-120 s) via the same DNS endpoint. It is for HA, not scaling.
  • Multi-AZ DB cluster (MySQL/PostgreSQL) has two readable standbys across 3 AZs with faster failover (~35 s or less).
  • Read Replicas are asynchronous, up to 15 for MySQL/MariaDB/PostgreSQL (5 for Oracle/SQL Server), can be cross-Region, and can be promoted to standalone databases.
  • Automated backups (1-35 days retention, point-in-time recovery to within 5 minutes) and manual snapshots stored in S3; restores always create a new instance.
  • Encryption at rest (KMS) must be chosen at creation; encrypt an existing DB by copying an unencrypted snapshot with encryption. SSL/TLS for in-transit.
  • RDS Proxy pools connections for Lambda and spiky apps and speeds failover; storage autoscaling grows storage automatically; max about 64 TiB.
  • Authenticate with passwords, IAM database authentication or Secrets Manager rotation; control network access with security groups in private subnets.

Detailed Notes

Engines and instance classes

EngineNotes
MySQL / MariaDBOpen source, up to 15 read replicas
PostgreSQLOpen source, rich features, up to 15 read replicas
OracleBYOL or license-included; RDS Custom available; 5 replicas
SQL ServerLicense-included; RDS Custom available; 5 replicas
AuroraAWS cloud-native engine (see the Aurora lesson)

Instance families include general purpose (M), memory optimised (R, X) and burstable (T). Storage types: gp3, io1/io2 (Provisioned IOPS for databases that need sustained high IOPS) and legacy magnetic. Storage autoscaling raises storage automatically up to a maximum you set.

Multi-AZ vs Read Replicas

Multi-AZRead Replica
PurposeHigh availability / DRRead scalability
ReplicationSynchronousAsynchronous (eventual consistency)
Reads on standbyNo (instance deployment); yes in Multi-AZ clusterYes
RegionSame Region, different AZSame AZ, cross-AZ or cross-Region
FailoverAutomatic, DNS flips to standbyManual promotion
EndpointSingle endpointEach replica has its own endpoint
Backups taken fromThe standby (no I/O pause on primary)n/a

Replicas can themselves be Multi-AZ, and a replica can be promoted for disaster recovery. Data transfer between AZs for replication is free inside a Region for RDS, but cross-Region replication is charged.

Backups and recovery

  • Automated backups run daily in a window plus transaction logs every 5 minutes, enabling point-in-time restore. Retention is 1 to 35 days (set to 0 to disable). They are deleted when the instance is deleted unless you keep them.
  • Manual snapshots persist until you delete them and can be shared or copied across Regions and accounts.
  • Restoring always creates a new DB instance with a new endpoint; you must repoint the application.
  • AWS Backup can centralise policies and cross-Region copies.

Security

  • Run in private subnets inside a DB subnet group that spans at least two AZs; control ingress with security groups (for example only from the app tier's SG).
  • Encryption at rest uses KMS and covers storage, backups, replicas and snapshots; it cannot be turned on later - snapshot, copy with encryption, restore.
  • Enforce TLS with the rds.force_ssl parameter (PostgreSQL) or require_secure_transport (MySQL).
  • IAM database authentication issues short-lived tokens (MySQL/PostgreSQL). Secrets Manager can rotate master credentials automatically.
bash
aws rds create-db-instance \
  --db-instance-identifier orders-db \
  --engine postgres --db-instance-class db.r6g.large \
  --allocated-storage 100 --storage-type gp3 \
  --master-username admin --manage-master-user-password \
  --multi-az --storage-encrypted \
  --backup-retention-period 14 \
  --db-subnet-group-name private-db-subnets \
  --vpc-security-group-ids sg-0abc123

Operational features

FeaturePurpose
RDS ProxyConnection pooling, reduces failover time by up to ~66%, IAM auth, great for Lambda
Performance InsightsVisualise DB load and top SQL
Enhanced MonitoringOS-level metrics at up to 1-second granularity
Blue/Green DeploymentsStaging copy for safe upgrades and schema changes with fast switchover
Event notificationsSNS alerts on failover, backup, maintenance
Reserved Instances1 or 3-year commitment for steady production databases

When RDS is not the answer

Use DynamoDB for key-value scale beyond a single instance, Redshift for analytics (OLAP), ElastiCache to offload repeated reads, and Aurora when you need up to 15 low-lag replicas, faster failover or serverless scaling.

Real World Example

Scenario — an e-commerce company runs its order-management system on RDS for PostgreSQL.

The database must survive an AZ outage with minimal downtime, while reporting queries and a mobile app's catalogue lookups were slowing down transactions.

The team deploys RDS PostgreSQL in Multi-AZ mode on db.r6g.2xlarge with gp3 storage, encryption and 14-day automated backups. Three read replicas serve the reporting tool and the catalogue API; one is in a second Region as a disaster-recovery target that can be promoted. Lambda functions that process order events connect through RDS Proxy so thousands of short-lived invocations cannot exhaust database connections. Credentials live in Secrets Manager with automatic rotation.

During a real AZ failure the Multi-AZ standby was promoted in about 90 seconds with no application change because the endpoint DNS name stayed the same.

Architecture Diagram

RDS Multi-AZ with read replicas and RDS Proxy
Architecture
AWS Cloud
App servers
Lambda
RDS Proxyconnection pool
Region
VPC
AZ A
DB subnet
Primaryreads + writes
AZ B
DB subnet
Standbyfailover target
AZ C
DB subnet
Read replicareporting

Multi-AZ provides synchronous failover; read replicas scale reads asynchronously.

  1. 1Application servers and Lambda functions connect through RDS Proxy, which pools and reuses database connections.
  2. 2Writes (and reads) go to the primary in AZ A; the data is replicated synchronously to the standby in AZ B.
  3. 3If the primary fails, RDS promotes the standby and flips the DNS endpoint, typically in 60-120 seconds.
  4. 4Asynchronous read replicas serve reporting and read-heavy queries, offloading the primary.

Best Practices

  • ✓Use Multi-AZ for every production database and place instances in private subnets behind security groups that allow only the application tier.
  • ✓Add read replicas for read-heavy or reporting workloads rather than scaling up the primary; use a cross-Region replica for DR.
  • ✓Enable encryption at creation, force TLS, and manage credentials with Secrets Manager or IAM authentication.
  • ✓Set backup retention to match your RPO (at least 7 days), copy snapshots cross-Region and test restores periodically.
  • ✓Put RDS Proxy in front of Lambda and highly concurrent clients to avoid connection exhaustion and shorten failover.
  • ✓Turn on storage autoscaling, Performance Insights and CloudWatch alarms (CPU, free storage, replica lag, connections).
  • ✓Use Blue/Green Deployments for major version upgrades and schema changes; schedule maintenance windows.
  • ✓Right-size with Reserved Instances or Savings Plans for steady load, and stop or snapshot-and-delete non-production databases.

Common Interview Questions

Exam Tips

SAA-C03 focus

  • Multi-AZ = HA / DR (synchronous, automatic failover). Read Replica = performance (asynchronous, read scaling). This is the most-tested RDS distinction.
  • Read replicas: up to 15 (MySQL, MariaDB, PostgreSQL, Aurora), 5 for Oracle and SQL Server; cross-Region supported; separate endpoints.
  • Automated backups: 1-35 days, PITR to ~5 minutes; restores create a new instance. Backups are lost on instance deletion unless retained.
  • Encryption can only be enabled at creation; to encrypt an existing DB use snapshot -> encrypted copy -> restore.
  • "Too many connections from Lambda" -> RDS Proxy. "Need OS access / custom engine features" -> RDS Custom (Oracle, SQL Server) or EC2.
  • "Relational but needs better performance, 15 replicas, faster failover" -> Aurora. "Key-value at massive scale" -> DynamoDB.
  • RDS in a private subnet; a DB subnet group needs subnets in at least 2 AZs. Access through security groups, never public by default.
  • Storage autoscaling prevents running out of disk; storage can only grow, never shrink.

Finished this lesson?

0 of 64 lessons done · 0% of the course