How DynamoDB’s Pricing Works, Gets Expensive Quickly and the Best Alternatives
DynamoDB is AWS’s NoSQL alternative to Cassandra, primarily marketed to mid-sized and large enterprises. The uses cases best suited for DynamoDB include those that require a flexible data model, reliable performance, and the automatic scaling of throughput capacity. DynamoDB’s landing page points out that mobile, web, gaming, ad tech, and IoT are all good application types for DynamoDB.
If you are still deciding whether or not DynamoDB is the correct choice for your use case, check out “11 Things Your Wish You Knew Before Starting with DynamoDB.”
How does DynamoDB pricing work?
In a nutshell, DynamoDB’s monthly cost is dictated by data storage, writes and reads. Detailed pricing is available on the official pricing page for DynamoDB. Remember that prices can vary based on the region. Below is a synopsis:
DynamoDB charges per GB of disk space a table consumes. The first 25 GB consumed per month is free, and prices start at $0.25 per GB-month thereafter.
AWS calculates the cost of writes using “Write Capacity Units.” Each WCU provides up to one write per second, enough for 2.6 million writes per month. The first 25 WCUs per month are free. At the time of writing this post, prices start at $0.47 per WCU-month thereafter. DynamoDB charges one write request unit for each write (up to 1 KB) and two write request units for transactional writes.
AWS calculates the cost of reads using “Read Capacity Units.” Each RCU provides up to two reads per second, enough for 5.2 million reads per month. The first 25 RCUs per month are free. As of the writing this post, prices start at $0.09 per RCU-month thereafter. For reads, DynamoDB charges one read request unit for each strongly consistent read (up to 4 KB), two read request units for each transactional read, and one-half read request unit for each eventually consistent read.
But wait, there’s more costs to consider…
There are some additional costs to be aware of which may affect your AWS bill at the end of the month besides data storage. Below are a few of them:
Depending on the target utilization you’ve specified, auto scaling will kick in and along with it additional costs associated with RCUs and WCUs. Basically, if you end up needing more throughput than you originally anticipated, expect to pay more…automatically.
If you have a good handle on the characteristics of your workload and the shelf life of your application, you can opt for the reserved capacity option that AWS offers. This allows you to lock in a significant savings in exchange for a 1-year contract, and paying a one-time upfront fee for the privilege.
Indexed data storage
Don’t forget that indexes in DynamoDB aren’t free. AWS tacks on 100 bytes of storage overhead per item to account for indexes. Indexes are then added to your data storage bill.
If you are going to be transferring data between AWS Regions expect to pay additional fees.
Need a cache in front of DynamoDB? AWS offers DynamoDB Accelerator (DAX.) With DAX you pay for capacity by the hour based on the instance type chosen.
This feature of DynamoDB allows you to deploy your tables across multiple AWS regions. Global tables are charged based on the resources associated with each replica table. Write capacity for global tables is represented by replicated WCUs instead of standard WCUs. Don’t forget about the fact that you are now transferring data between AWS Regions, so expect additional fees.
Are you going to need to backup your DynamoDB instance for data archiving or compliance purposes? If so, expect to pay an additional fee per GB.
Continuous backups and point-in time recovery
Instead of backing up data on demand, do you want to enable continuous backups and point-in-time recovery? AWS will perform this task for you for an additional fee per GB.
Restoring a table
Need to restore a table from a backup? AWS will charge you per GB restored.
AWS offers DynamoDB Streams, which is a time-ordered sequence of item-level changes on a DynamoDB table. The first 2.5M reads per month are free, and $0.02 per 100,000 after that.
After 10+ years of evangelizing the benefits of eventual consistency and the overkill of ACID transactions in distributed databases, Amazon DynamoDB finally announced support for ACID transactions. As one can expect for an initial release, the offering is severely restrictive.
- Each transaction can include up to 10 unique items or up to 4 MB of data, including conditions.
- Available on only single-region DynamoDB tables.
- Transactions are disabled on global tables by default. You can choose to enable transactions on global tables by request, but replication across regions is asynchronous and eventually consistent. You may observe partially completed transactions during replication to other regions. Additionally, simultaneous writes to the same item in different regions are not guaranteed to be serially isolated.
- Using transactions will deplete your provisioned throughput faster and end up costing you more. DynamoDB performs two underlying reads or writes of every item in the transaction, one to prepare the transaction and one to commit the transaction.
- No support for globally consistent secondary indexes even though the underlying database now has support for transactions.
When using the newly announced on-demand mode, you don’t need to specify how much read and write throughput you expect your application to perform. DynamoDB charges you for the reads and writes that your application performs on your tables in terms of read request units and write request units.
Calculating your DynamoDB costs
The accuracy of what you’ll pay at the end of the month is all going to depend on how good of a job you’ve done in estimating your workload and how that will translate into storage, RCU, WCUs and any DynamoDB “add-ons” you’ve opted in for.
AWS provides a handy calculator to help you estimate DynamoDB pricing for your workload.
When does DynamoDB become expensive?
If an application grows very quickly with increasingly larger data volumes that need to be stored and served, and if low latency and geo-distribution are must-have requirements for driving customer satisfaction, then DynamoDB becomes a cost-prohibitive choice that will also slow down release velocity.
You can read more about how DynamoDB becomes an expensive choice for fast growing companies in “The Million Dollar Engineering Problem” and in “11 Things You Wish You Knew Before Starting with DynamoDB.”
Are there more cost effective alternatives to DynamoDB?
Yes! And without making any compromises on features or functionality. You can actually save well over 10x by choosing an alternative database. There are several solid alternatives to choose from including:
For a detailed comparison of how DynamoDB stacks up against these popular projects in regards to features and TCO, read: “DynamoDB vs MongoDB vs Cassandra for Fast Growing Geographically Distributed Applications.”
What is YugaByte DB?
YugabyteDB is an open source distributed SQL multi-API/multi-model database with transactional consistency, low latency and geo-distribution built into the core of a common storage engine. It is a Consistent and Partition-tolerant (CP) database with a native JSONB document data type, high performance secondary indexes, cloud native operational ease and the ability to handle high data density. It allows application architects unparalleled data modeling through its 3 APIs namely the Redis-compatible Key-Value API, the Casssandra-compatible Flexible Schema API and the PostgreSQL-compatible SQL API (in beta). These aspects make YugabyteDB an excellent alternative to DynamoDB.