DynamoDB Capacity Units Calculator: RCU, WCU & Cost Guide
DynamoDB's capacity model — Read Capacity Units and Write Capacity Units — determines both performance and cost. Understanding how item sizes map to capacity consumption is essential to avoid throttling and bill surprises.
RCU and WCU Calculation Rules
| Operation | Capacity Rule | Example: 3KB item | Example: 7KB item |
|---|---|---|---|
| Strongly consistent read | 1 RCU per 4KB | 1 RCU | 2 RCUs |
| Eventually consistent read | 0.5 RCU per 4KB | 0.5 RCU | 1 RCU |
| Transactional read | 2 RCUs per 4KB | 2 RCUs | 4 RCUs |
| Write (PutItem/UpdateItem) | 1 WCU per 1KB | 3 WCUs | 7 WCUs |
| Transactional write | 2 WCUs per 1KB | 6 WCUs | 14 WCUs |
On-Demand vs Provisioned Pricing
| Mode | Read Cost | Write Cost | Best For | Risk |
|---|---|---|---|---|
| On-Demand | $0.25/M RRUs | $1.25/M WRUs | Spiky / unpredictable | 5-10x higher at sustained load |
| Provisioned | $0.00013/RCU-hr | $0.00065/WCU-hr | Predictable traffic | Over/under-provision risk |
Provisioned Capacity with Auto Scaling
# Terraform: DynamoDB with auto-scaling
resource "aws_dynamodb_table" "users" {
name = "users"
billing_mode = "PROVISIONED"
read_capacity = 5 # Minimum provisioned
write_capacity = 5
hash_key = "id"
attribute {
name = "id"
type = "S"
}
ttl {
attribute_name = "expiresAt" # TTL = free deletes
enabled = true
}
}
# Auto-scaling policy (scales between 5-100 WCU)
resource "aws_appautoscaling_target" "dynamodb_write" {
max_capacity = 100
min_capacity = 5
resource_id = "table/${aws_dynamodb_table.users.name}"
scalable_dimension = "dynamodb:table:WriteCapacityUnits"
service_namespace = "dynamodb"
}
resource "aws_appautoscaling_policy" "dynamodb_write_policy" {
name = "DynamoDBWriteCapacityUtilization"
policy_type = "TargetTrackingScaling"
resource_id = aws_appautoscaling_target.dynamodb_write.resource_id
scalable_dimension = aws_appautoscaling_target.dynamodb_write.scalable_dimension
service_namespace = aws_appautoscaling_target.dynamodb_write.service_namespace
target_tracking_scaling_policy_configuration {
predefined_metric_specification {
predefined_metric_type = "DynamoDBWriteCapacityUtilization"
}
target_value = 70.0 # Scale when 70% utilized
}
} Cost Optimization Strategies
// 1. Use eventually consistent reads (half the RCU cost)
const result = await dynamoDB.get({
TableName: 'users',
Key: { id: { S: userId } },
ConsistentRead: false // Eventually consistent = 0.5 RCU (default)
// ConsistentRead: true = 1 RCU (use only when freshness required)
}).promise();
// 2. Project only needed attributes
const result = await dynamoDB.query({
TableName: 'orders',
KeyConditionExpression: 'userId = :uid',
ExpressionAttributeValues: { ':uid': { S: userId } },
// Only fetch what you need — reduces data transfer and effective RCU
ProjectionExpression: 'orderId, #s, amount',
ExpressionAttributeNames: { '#s': 'status' },
}).promise();
// 3. Use TTL for auto-cleanup (0 WCU for deletes)
const item = {
id: { S: sessionId },
userId: { S: userId },
data: { S: JSON.stringify(sessionData) },
// TTL: Unix timestamp — DynamoDB deletes automatically (free!)
expiresAt: { N: String(Math.floor(Date.now() / 1000) + 86400) }
}; Related Products
on GumroadDeveloper Productivity Bundle
Stop rebuilding the same setup every project. 51 VSCode snippets, 40 Git aliases, 5 Docker Compose stacks, 5 GitHub Actions workflows, 5 README templates, and a dotfiles kit. Set up a professional dev environment in under an hour.
Buy on Gumroad →AI Prompt Engineering Toolkit
58 structured prompt templates for Claude, ChatGPT, and Gemini — organized by use case. Code Review, Debugging, Documentation, Architecture, and 10 model-specific tips. Stop writing prompts from scratch.
Buy on Gumroad →Developer Cheat Sheet Bundle
10 print-ready cheat sheets for the tools developers use every day: Git, Docker, Linux CLI, SQL, Regex, HTTP Status codes, VS Code shortcuts, Bash scripting, jq/JSON, and Markdown.
Buy on Gumroad →You Might Also Need
LLM Cost Calculator
Compare monthly API costs across GPT-4o, Claude Sonnet, Gemini Pro, and 12+ models. Enter daily requests and token counts for instant cost estimates.
Open free tool →
AWS CDK Infrastructure as Code Guide
Complete AWS CDK guide for TypeScript/Python IaC. Learn constructs (L1/L2/L3), stacks, CDK Pipelines, diff/deploy workflow, and comparison with Terraform and CloudFormation.
Open free tool →
AWS Cost Estimator
Estimate monthly AWS costs for EC2, RDS, S3, CloudFront, and Load Balancers. Interactive calculator with itemized breakdown.
Open free tool →
More Free Tools
Related Articles
AWS Lambda Cold Start Optimization: 10 Proven Techniques 2026
Eliminate or minimize AWS Lambda cold starts with 10 proven techniques: provisioned concurrency, SnapStart, package minimization, ARM Graviton2, lazy loading, and more with benchmark data.
Cloud Deployment Tools in 2026: From Containers to Serverless
A practical guide to cloud deployment tools in 2026. Compare deployment strategies, container platforms, serverless frameworks, and GitOps workflows that enterprise teams use to ship software reliably.
Convex vs Supabase vs PlanetScale vs Neon: Serverless Database Comparison 2026
In-depth comparison of Convex, Supabase, PlanetScale, and Neon for serverless database needs. Pricing, performance, developer experience, and real-world use cases.
Database Connection Pooling Best Practices: pgBouncer, pg-pool & More
Database connection pooling guide: why connection limits matter, pg-pool configuration for Node.js, pgBouncer setup, pool sizing formula, connection leaks, and serverless pooling with Neon/Supabase.
Serverless Database Guide: PlanetScale vs Neon vs Turso vs Upstash 2026
Which serverless database fits your stack in 2026? Compare PlanetScale, Neon, Turso, and Upstash: HTTP drivers, connection pooling, pricing, branching, and use case recommendations.
Enjoying this tool? Get more like it.
Weekly developer tool guides, productivity playbooks & AI tricks. Free. No spam.
Unlock AI-Powered Dev Tools
- ⚡ AI Code Review, Doc Generator & SQL Builder
- ⚡ All premium templates & early access
- ⚡ Member discounts on Gumroad products
$9/mo after trial · Cancel anytime
Want the full toolkit?
Get DevPlaybook Pro
Every template, guide, boilerplate, and automation script in one bundle. 13 premium products — grab them all at once and save big.
MIT licensed · Instant download · No subscription
See what's included → Browse all deals →Frequently Asked Questions
What is a Read Capacity Unit (RCU)?▼
One Read Capacity Unit (RCU) represents the throughput for one strongly consistent read per second for items up to 4KB. Eventually consistent reads use half an RCU. For items larger than 4KB, AWS rounds up to the next 4KB boundary — a 5KB item costs 2 RCUs for a strongly consistent read, or 1 RCU eventually consistent. For transactional reads (TransactGetItems), each read consumes 2 RCUs.
What is a Write Capacity Unit (WCU)?▼
One Write Capacity Unit (WCU) represents one write per second for items up to 1KB. Larger items require proportionally more WCUs — a 3.5KB item rounded up to 4KB costs 4 WCUs. Transactional writes (TransactWriteItems) consume 2 WCUs per item. Conditional writes that fail still consume WCUs. Batch writes (BatchWriteItem) are not transactional but each item still consumes 1 WCU per KB.
When should I use On-Demand vs Provisioned capacity?▼
On-Demand capacity is ideal for unpredictable traffic, new tables without traffic baselines, spiky workloads, and development/test environments. It costs roughly $1.25 per million read requests and $1.25 per million write requests. Provisioned capacity with Auto Scaling is better for predictable sustained traffic — it can be 5-10x cheaper at steady load. On-Demand can be up to 7x more expensive per operation than well-provisioned Provisioned mode.
How do Global Secondary Indexes affect capacity?▼
GSI reads are billed from the GSI's own capacity pool, not the table's. If you provision 100 WCUs on a table and add a GSI that updates on every write, those GSI writes also consume capacity — from the GSI's provisioned capacity. In On-Demand mode, GSI operations are charged at the same per-request rates. Over-projecting attributes to GSIs wastes write capacity since every projected attribute is replicated on writes.
How does DynamoDB TTL affect capacity?▼
DynamoDB TTL deletions are performed in the background and do not consume Write Capacity Units. DynamoDB deletes expired items within 48 hours of expiration. TTL is one of the most effective cost optimization strategies — use it to automatically expire session data, temporary tokens, rate limit counters, and any time-bound records rather than deleting them manually with WCUs.
What is the DynamoDB pricing for storage?▼
DynamoDB storage costs $0.25 per GB/month. The first 25GB is free under the AWS Free Tier. For large tables, storage can exceed the per-request cost. Optimize storage by: keeping item sizes small (avoid storing large blobs — use S3 instead), using sparse indexes (only index items that need the GSI), compressing large attributes, and using TTL to expire obsolete data.