0
0
DynamoDBquery~5 mins

Cost estimation for access patterns in DynamoDB

Choose your learning style9 modes available
Introduction

Knowing the cost helps you plan your spending when using DynamoDB. It shows how much you pay based on how you access your data.

When deciding how to design your database tables to save money.
Before building an app that will use DynamoDB to estimate monthly costs.
When you want to compare different ways to get data and pick the cheapest.
To understand how many reads and writes your app will need.
When monitoring your app to avoid unexpected high bills.
Syntax
DynamoDB
Cost = (Read Capacity Units * Price per RCU) + (Write Capacity Units * Price per WCU) + Storage Cost
RCU means Read Capacity Unit, which is how many strongly consistent reads you can do per second for items up to 4 KB.
WCU means Write Capacity Unit, which is how many writes you can do per second for items up to 1 KB.
Examples
This shows how to calculate read units and cost for strong reads.
DynamoDB
If you do 100 strongly consistent reads per second, and each item is 4 KB:
RCU needed = 100 * (4 KB / 4 KB) = 100
Cost = 100 * $0.00013 (example price)
This shows how to calculate write units and cost for writes.
DynamoDB
If you write 50 items per second, each 2 KB:
WCU needed = 50 * (2 KB / 1 KB) = 100
Cost = 100 * $0.00065 (example price)
Sample Program

This query calculates the monthly cost for given read and write capacity units using example prices and hours.

DynamoDB
-- Example: Calculate monthly cost for 200 RCUs and 100 WCUs
-- Assume prices: RCU = $0.00013 per unit-hour, WCU = $0.00065 per unit-hour
-- Assume 730 hours in a month

SELECT
  200 * 0.00013 * 730 AS read_cost_usd,
  100 * 0.00065 * 730 AS write_cost_usd,
  (200 * 0.00013 * 730) + (100 * 0.00065 * 730) AS total_cost_usd;
OutputSuccess
Important Notes

Costs depend on your region and pricing plan, so check AWS pricing for exact numbers.

Using eventually consistent reads costs half as much as strongly consistent reads.

Large items use more capacity units, so smaller items save money.

Summary

Cost depends on how many reads and writes you do per second.

Calculate capacity units based on item size and consistency.

Multiply capacity units by price and time to estimate cost.