Scaling DynamoDB, Aurora Serverless v2 and RDS Proxy
Overview
Managed databases remove patching and hardware work, but you still choose how they scale. For SOA-C03 you must configure and manage scaling for Amazon RDS, Aurora and DynamoDB, and recognise when to use RDS Proxy to tame connection storms from Lambda or large fleets.
Compare a toll road with fixed lanes (provisioned capacity) to one that opens or closes lanes on its own as traffic changes (on-demand and Serverless v2). Fixed lanes are cheaper when traffic is predictable; automatic lanes are safer when traffic is spiky. RDS Proxy is the toll plaza that funnels thousands of cars into a few efficient lanes so the road is not overwhelmed.
The operator needs to read the signals: throttled requests for DynamoDB, ACU utilisation and replica lag for Aurora, connection counts for RDS.
Key Concepts
- DynamoDB capacity modes: on-demand (pay per request, instant scaling) vs provisioned (set RCU/WCU, optionally with auto scaling via target tracking).
- Throttling shows as
ProvisionedThroughputExceededException; CloudWatch metricsReadThrottleEvents,WriteThrottleEvents,ThrottledRequests. Causes: under-provisioning or a hot partition key. - Aurora Serverless v2 scales in fine-grained ACUs (0.5 ACU steps) within a min/max range you set, and can scale to 0 ACU with auto-pause for dev workloads.
- Aurora scales reads with up to 15 replicas sharing one storage volume; a reader endpoint load-balances them; Aurora Auto Scaling adds or removes replicas.
- RDS (non-Aurora) scales vertically (modify instance class), by storage auto scaling, and horizontally for reads with read replicas (up to 15 for MySQL/MariaDB/PostgreSQL).
- RDS Proxy pools and shares connections, keeps connections alive through failover (faster, up to roughly 66% shorter failover) and uses IAM authentication and Secrets Manager.
- DynamoDB Global Tables give multi-Region, multi-active replication; TTL deletes expired items for free; DAX and PITR complete the operational picture.
- Use CloudWatch alarms on
DatabaseConnections,CPUUtilization,FreeableMemory,ReplicaLagandServerlessDatabaseCapacity.
Detailed Notes
DynamoDB capacity modes
| Aspect | On-demand | Provisioned (with auto scaling) |
|---|---|---|
| Planning | None | Set min, max and target utilization |
| Cost profile | Higher per request, no idle cost | Lower for steady traffic; reserved capacity discounts |
| Scaling speed | Instant to prior peak x2 (then continues) | Minutes; can throttle on sudden spikes |
| Best for | Unknown or spiky traffic, new tables | Predictable workloads |
You can switch modes (on-demand to provisioned once per 24 hours is limited; check current quotas). Standard-IA table class reduces storage cost for rarely read data.
aws dynamodb update-table --table-name Orders --billing-mode PAY_PER_REQUEST
aws application-autoscaling register-scalable-target --service-namespace dynamodb \
--resource-id table/Orders --scalable-dimension dynamodb:table:WriteCapacityUnits \
--min-capacity 5 --max-capacity 500
aws application-autoscaling put-scaling-policy --service-namespace dynamodb \
--resource-id table/Orders --scalable-dimension dynamodb:table:WriteCapacityUnits \
--policy-name wcu-target --policy-type TargetTrackingScaling \
--target-tracking-scaling-policy-configuration '{"TargetValue":70.0,"PredefinedMetricSpecification":{"PredefinedMetricType":"DynamoDBWriteCapacityUtilization"}}'
Diagnosing DynamoDB throttling
| Symptom | Cause | Fix |
|---|---|---|
| Throttles while consumed capacity is below provisioned | Hot partition (skewed partition key) | Choose a high-cardinality key, add write sharding, use DAX for read hotspots |
| Throttles at capacity limit | Under-provisioned or slow auto scaling | Raise max, lower target, or use on-demand |
| GSI throttling blocks writes to base table | GSI under-provisioned | Match GSI capacity to base table write rate |
| Sudden spike on a new on-demand table | Initial throughput limits | Pre-warm by setting a higher previous peak |
Use CloudWatch Contributor Insights for DynamoDB to find the most accessed keys.
Aurora scaling
| Option | What scales | Notes |
|---|---|---|
| Aurora Serverless v2 | Compute in ACUs, per second, in place | Min/max ACU; mixes with provisioned instances in one cluster |
| Aurora replicas + Auto Scaling | Read capacity | Target tracking on CPU or connections |
| Instance class change | Writer compute | Brief outage or failover |
| Storage | Automatic up to 128 TiB | No operator action |
aws rds modify-db-cluster --db-cluster-identifier prod-aurora \
--serverless-v2-scaling-configuration MinCapacity=0.5,MaxCapacity=32
aws rds create-db-instance --db-instance-identifier prod-aurora-sv2-1 \
--db-cluster-identifier prod-aurora --engine aurora-mysql --db-instance-class db.serverless
If ServerlessDatabaseCapacity sits at the maximum while CPU is high, raise the max ACU. If it sits at the minimum yet latency is poor after idle periods, raise the minimum so buffer cache stays warm.
RDS scaling choices
| Need | Action |
|---|---|
| More CPU/memory | Modify instance class (maintenance window or immediate; brief downtime on Single-AZ) |
| Disk filling | Enable storage autoscaling (set max allocated storage) |
| Read-heavy reporting | Add read replicas (asynchronous); can be cross-Region |
| IOPS bound | Switch to gp3 / io2 and raise provisioned IOPS |
| Too many connections | Add RDS Proxy or raise max_connections via parameter group |
RDS Proxy
aws rds create-db-proxy --db-proxy-name app-proxy --engine-family MYSQL \
--auth '[{"AuthScheme":"SECRETS","SecretArn":"arn:aws:secretsmanager:us-east-1:111122223333:secret:db-creds","IAMAuth":"REQUIRED"}]' \
--role-arn arn:aws:iam::111122223333:role/ProxyRole --vpc-subnet-ids subnet-a subnet-b
Use RDS Proxy when Lambda functions or large container fleets open many short-lived connections, when you need faster failover handling and when you want IAM authentication instead of passwords in code. It sits in the same VPC, and applications connect to the proxy endpoint. Watch DatabaseConnections, ClientConnections and MaxDatabaseConnectionsAllowed.
Performance Insights
RDS Performance Insights shows database load (average active sessions) broken down by wait event, SQL, host and user. Its proactive recommendations point at issues such as missing indexes. This ties directly to the monitoring task statement for RDS performance (see the database performance lesson in the storage chapter).
Real World Example
Scenario – Lambda exhausts the database. A serverless order API on Lambda talks to an RDS for PostgreSQL instance. At peak, thousands of concurrent invocations each open a connection, DatabaseConnections hits the limit and clients see "too many connections".
The team places RDS Proxy in front of the database and switches the function to the proxy endpoint with IAM authentication. Connections are pooled, the database stays below 20% of max_connections and failover time falls from about a minute to a few seconds. For the analytics read path they migrate to Aurora with Serverless v2 readers (min 1 ACU, max 16) so reporting scales automatically without an always-on large instance.
Architecture Diagram
- 1Clients connect to RDS Proxy, which multiplexes them onto a small connection pool.
- 2Writes go to the Aurora writer; reads use the reader endpoint.
- 3Serverless v2 readers add or remove ACUs between the configured min and max.
- 4DynamoDB tables scale through on-demand mode or provisioned auto scaling.
- 5CloudWatch alarms on throttles, connections, CPU and capacity drive tuning.
Best Practices
- ✓Pick on-demand for unpredictable DynamoDB traffic and provisioned with auto scaling (plus reserved capacity) for steady traffic.
- ✓Design high-cardinality partition keys and watch Contributor Insights to avoid hot partitions.
- ✓Set realistic min and max ACU for Serverless v2 and alarm when capacity pins at the maximum.
- ✓Put RDS Proxy in front of databases used by Lambda or very large fleets; enforce IAM auth and Secrets Manager.
- ✓Enable storage autoscaling and alarm on
FreeStorageSpace,ReplicaLagandDatabaseConnections.
Common Interview Questions
Exam Tips
SOA-C03 focus
- Lambda + RDS connection errors -> RDS Proxy.
- Unpredictable DynamoDB traffic, no capacity planning -> on-demand; steady traffic cost optimisation -> provisioned + auto scaling.
- Variable relational load with automatic compute scaling -> Aurora Serverless v2.
- Disk running out on RDS -> storage autoscaling; read-heavy -> read replicas; Multi-AZ is for availability, not read scaling.
Finished this lesson?
0 of 46 lessons done · 0% of the course

