AWS & Modern Cloud Architecture · Chapter 7 · ~25 min · Advanced
Cloud Databases: RDS, Aurora & DynamoDB
Unlock modern cloud persistence: contrast traditional relational RDS with cloud-native Aurora’s distributed storage engine, and master high-throughput NoSQL partition modeling with Amazon DynamoDB.
- Compare relational RDS, cloud-native Aurora, and distributed NoSQL DynamoDB architectures
- Master Multi-AZ synchronous primary/standby replication and automated zero-data-loss failover
- Understand Aurora's decoupled storage engine with 6-way replication across 3 AZs
- Design DynamoDB partition key hash distribution and tune RCU/WCU throughput limits
Cloud Databases: RDS, Aurora & DynamoDB: learn it visually
Select and configure cloud databases: RDS Multi-AZ synchronous failover and Aurora storage engines vs DynamoDB serverless NoSQL with partition key hashing and provisioned capacity.
1Amazon RDS: Relational Persistence Made Managed
Managing database instances manually on raw virtual machines requires continuous maintenance: operating system patches, security updates, database engine configuration, automated backup scripting, and building fragile primary-to-standby failover monitors.
Amazon Relational Database Service (RDS) abstracts the underlying server operating system while delivering native relational engines: PostgreSQL, MySQL,MariaDB, Oracle, and Microsoft SQL Server.
Point-in-Time Recovery
RDS takes daily snapshot backups and archives transaction write-ahead logs (WAL) to Amazon S3 every 5 minutes, enabling point-in-time restores down to the second.
Synchronous Standby
Every committed write is synchronously mirrored to a standby server in an isolated Availability Zone. If the primary fails, AWS flips DNS records within 60 seconds with zero data loss.
Read Replicas
Offload compute-heavy analytical reports and read queries to up to 15 asynchronous read replicas across multiple AZs or international AWS Regions.
What is the critical architectural difference between an RDS Multi-AZ Standby and an RDS Read Replica?
2Architectural Mental Models: Storage, Failover & Scalability
Engineers frequently confuse read scaling with write scaling, or mistake Aurora for a simple managed wrapper around standard MySQL. Examine these three structural shifts:
Wrong idea: Installing PostgreSQL on an EC2 instance saves money with zero operational overhead
Assuming that running MySQL or Postgres on raw EC2 VMs is cheaper and easy to maintain without dedicated database administrators.
Real system: Amazon RDS automates multi-AZ replication, snapshots & automated failover
AWS RDS manages OS updates, point-in-time recovery, automated backups, and synchronous synchronous replication across Availability Zones with automated health-check failover.
3Amazon Aurora: Decoupling Compute from Storage
Traditional databases couple the SQL query engine (CPU/RAM) directly to the local block storage filesystem (EBS). When scaling replicas or recovering from crashes, the system must stream gigabytes of raw data blocks over the network.
Amazon Aurora fundamentally re-architects relational databases for the cloud by separating the compute layer from a purpose-built, log-structured distributed storage fleet:
Aurora's 6-Way Storage Quorum Model:
- Distributed Striping: Database storage is broken into 10 GB segments and striped across hundreds of storage nodes.
- 6 Copies Across 3 AZs: Every write produces 6 copies across 3 Availability Zones (2 copies per AZ).
- Quorum Writes (4 of 6): Aurora confirms a write transaction as soon as 4 of the 6 storage nodes acknowledge receipt of the redo log, ignoring the 2 slowest nodes.
- Quorum Reads (3 of 6): Aurora reads data by querying 3 nodes to reconstruct the latest log sequence, tolerating an entire AZ loss without any read interruption.
- Self-Healing Background Gossip: Storage nodes continuously exchange peer gossip to automatically heal corrupted blocks or recover from hardware node crashes.
-- Connecting to Aurora Clustered Endpoints
-- 1. Writer Endpoint (Always routes to current primary read-write master)
psql -h production-cluster.cluster-xyz.us-east-1.rds.amazonaws.com -U dbadmin -d appdb
-- 2. Reader Endpoint (Load-balances read queries round-robin across all healthy replicas)
psql -h production-cluster.cluster-ro-xyz.us-east-1.rds.amazonaws.com -U dbadmin -d appdbHow does Amazon Aurora achieve 5x the throughput of standard MySQL on identical compute hardware?
4Amazon DynamoDB: Single-Digit Millisecond NoSQL
When web applications reach millions of concurrent users, relational databases hit hard limits due to table locks, foreign key checks, and joins across un-sharded tables.
Amazon DynamoDB is a fully managed, serverless NoSQL key-value and document database that guarantees consistent, single-digit millisecond response times at any scale.
Partition Key (HASH)
DynamoDB feeds the partition key into an internal cryptographic hash function. The resulting hash determines which physical storage partition holds the item. Uniform partition key distribution prevents hot partitions!
Sort Key (RANGE)
Together with the partition key, the sort key forms a composite primary key. All items sharing the same partition key are stored physically contiguous, sorted by this key, enabling lightning-fast range queries (e.g. begins_with() or between).
Capacity Modes: Provisioned vs. On-Demand
On-Demand Mode: Ideal for unpredictable workloads. Charges per million reads/writes with zero capacity planning.
Provisioned Mode: Specify exact Read Capacity Units (RCU) and Write Capacity Units (WCU). 1 RCU provides 1 strongly consistent read per second for items up to 4 KB. 1 WCU provides 1 standard write per second for items up to 1 KB.
You are designing an IoT sensor DynamoDB table receiving millions of temperature readings per hour. Why is using 'DeviceType' (e.g., 'Thermostat') as the lone Partition Key an anti-pattern?
5Hands-On: Test Multi-AZ Failover & DynamoDB Partition Routing
Use the interactive simulator below to test an RDS primary failure and observe sub-minute CNAME DNS failover. Then switch tabs to inspect DynamoDB's key hash routing and WCU throttle thresholds:
Cloud Database Architectural Engine Simulator
Observe synchronous physical replication to the Standby in an isolated Availability Zone, plus asynchronous replication to the read replica in AZ-C.
Postgres 16 Primary
Endpoint: db.prod.internal
Passive Warm Standby
No direct user queries permitted
Read Replica #1
Endpoint: db-read.prod.internal
6Bug Hunt: Fix the DynamoDB Production Table Definition
A DevOps engineer drafted this CloudFormation JSON snippet for a mission-critical e-commerce order table. However, the primary key schema is inverted, and disaster recovery protections are disabled. Fix the template so that OrderId is the partition key (HASH), CreatedAt is the sort key (RANGE), and Point-in-Time Recovery is enabled:
🎯 Find and fix the bugs in the code above, then press Run & verify to test your solution.
Need a hint?
- In DynamoDB key schemas, the unique identifier (
OrderId) must have"KeyType": "HASH". - The chronological attribute (
CreatedAt) must have"KeyType": "RANGE". - Set
PointInTimeRecoveryEnabledtotruefor continuous incremental backups.
7Chapter Knowledge Challenge
Validate your cloud database architectural mastery before proceeding to Serverless Computing:
A financial services client requires 99.99% database availability. If an Availability Zone suffers a hardware outage, which solution guarantees the fastest failover with zero manual intervention?
Your application uses DynamoDB in Provisioned capacity mode with 50 WCU. A sudden viral tweet causes write traffic to surge to 250 requests per second. What will happen?
8Recap & Architecture Best Practices
- RDS Multi-AZ: Employs synchronous physical block replication for automatic zero-data-loss failover in under 60 seconds.
- Read Replicas: Scale analytical and read queries asynchronously; they do not alleviate write bottlenecks on the primary master.
- Amazon Aurora: Decouples compute from a distributed 6-way log-structured storage engine across 3 AZs with 4/6 quorum write consensus.
- Amazon DynamoDB: Serverless NoSQL engineered for horizontal scaling via partition key hash distribution and predictable single-digit millisecond latency.
Ready for Chapter 8? Mark this chapter as complete to proceed to Serverless Computing: