DEV Community

Michael Tsibelman
Michael Tsibelman

Posted on

DynamoDB pricing in simple terms

I was doing some analysis on DynamoDB pricing and wanted to share it with you all.
DynamoDB has two modes of billing: the first is a capacity-based mode (RCU/WCU), the second one is a pay-per-request payment mode.
These modes have very different pricing mechanisms, and it is important to understand the differences.

Provisioned Capacity

In this mode, the price based on your desired throughput in KB/s, RCU (read capacity unit) stands for 4KB/sec, and WCU (write capacity unit) stands for 1KB/sec.
So when you think about how much WCU/RCU your application requires, you need to understand what it is your maximum throughput at any given time (your highest spike) and not how much traffic you have overall.
To demonstrate this difference see the two graphs below. In both of them, we need to write 5KB of data but in the left graph we have a peak where all 5KB is written at once, and on the right-hand side, we have an even distribution of 1KB/s.
Alt Text
To accommodate the first scenario you will need to buy 5 WCU and for a right-hand scenario you need just 1 WCU, so it will be five times cheaper.
This leads to situations where even low traffic application needs to overcommit on WCUs to accommodate occasional peaks in traffic.
The payment has a resolution of one hour, so if your application has predictive daily variability, it’s possible to write a smart scheduling mechanism to adjust your WCU capacity according to the time of day to accommodate this variability.
AWS provides some rudimentary auto-scheduling implementation that can adjust your capacity based on previous traffic patterns, but it’s not very responsive, and I don’t recommend relying on it for more critical applications.
In this mode tables and their indexes can have a different capacity so it is possible to have a less expensive bill for some operations that you are ok with doing over more extended periods.

On-Demand pay per request mode

This is a simpler model to understand, in this mode throughput is not important at all, your bill is based on the total numbers of requests instead. So for the graphs above you will pay the same for both scenarios. And if your DB not used at all, you pay zero, which is very useful for testing and dev environments.
So if you have situations where the total number of requests is relatively small, but the variance in throughput is high, it will be way cheaper to use the per request mode.
Below you can find a small calculator where you can play with the numbers:
https://docs.google.com/spreadsheets/d/10Y_cMZF3JAeH5z2F7qsVVAw3qSEGL5cOQ_sFNOq2kPk/edit?usp=sharing

If you have any question, please feel free to ask, DynamoDB pricing it’s an overly complex subject in my opinion, and I am hoping I didn’t miss anything, so please tell me if you found something you believe isn’t accurate

Top comments (0)