← Week 2: DynamoDB Internals

Day 9: DynamoDB Capacity Planning

Phase 5 · Aug 20, 2026

← Week 2: DynamoDB Internals

Agenda (2–3 hours)

  • Read (45 min): DynamoDB capacity documentation; DynamoDB pricing page; AWS "Choosing the Right DynamoDB Capacity Mode" blog post
  • Study (45 min): Calculate RCU/WCU for a table with 1KB average item size at 500 reads/s and 100 writes/s; compare on-demand vs provisioned cost
  • Practice (45 min): Enable CloudWatch contributor insights on a DynamoDB table; identify the top 5 partition keys by access volume
  • Challenge (30 min): Design a capacity auto-scaling policy for a table with highly variable traffic (1-100× daily variation)
← Week 2: DynamoDB Internals

Read and Write Capacity Units

WCU (Write Capacity Unit):

  • 1 WCU = 1 write/s of up to 1KB
  • Item > 1KB: round up to nearest KB
  • Example: 500 writes/s × 2KB items = 1,000 WCU

RCU (Read Capacity Unit):

  • 1 RCU = 1 strongly-consistent read/s of up to 4KB
  • Eventually consistent reads consume ½ RCU
  • Example: 500 reads/s × 1KB items = 125 RCU (eventually consistent)

Burst capacity: DynamoDB retains unused capacity for short spikes (up to 5 minutes worth of unused capacity)

← Week 2: DynamoDB Internals

Capacity Modes

Provisioned:

  • You specify RCU/WCU targets
  • Throttled when you exceed provisioned capacity
  • Auto-scaling: DynamoDB adjusts within defined min/max range
  • Cost: ~$0.00065/RCU/hr + $0.00013/WCU/hr

On-Demand:

  • No capacity planning; AWS scales automatically
  • Pay per request: ~$1.25 per million writes, $0.25 per million reads
  • Good for unpredictable workloads; 2-10× more expensive at sustained load

Rule of thumb: provisioned + auto-scaling for predictable production workloads; on-demand for dev/test or highly variable new services.

← Week 2: DynamoDB Internals

Auto-Scaling Configuration

# CloudFormation
TableAutoScalingRole:
  Type: AWS::IAM::Role
  # ... policy allowing application-autoscaling to update DynamoDB capacity

WriteScalingPolicy:
  Type: AWS::ApplicationAutoScaling::ScalingPolicy
  Properties:
    PolicyType: TargetTrackingScaling
    TargetTrackingScalingPolicyConfiguration:
      TargetValue: 70  # target 70% utilization
      PredefinedMetricSpecification:
        PredefinedMetricType: DynamoDBWriteCapacityUtilization

Target 70% utilization: leaves headroom for traffic spikes; scaling lags ~2 minutes.

← Week 2: DynamoDB Internals

Adaptive Capacity

DynamoDB Adaptive Capacity automatically shifts capacity from cold partitions to hot ones:

  • Works within your provisioned capacity; doesn't allow exceeding the table limit
  • Handles "time-of-day" hot partition patterns automatically
  • Not a substitute for good partition key design — handles imbalance, not sustained hot partitions
← Week 2: DynamoDB Internals

Key Takeaways

  • RCU/WCU are the billing and quota units; calculate based on item size × request rate
  • Eventually consistent reads cost half; use them when strong consistency isn't needed
  • Provisioned + auto-scaling: best for sustained predictable workloads; on-demand for variable
  • Adaptive capacity handles temporary hot partitions; Contributor Insights identifies persistent hot keys

Tomorrow: DynamoDB consistency and transaction patterns.