DynamoDB is an AWS database for NoSQL high-performance applications. DynamoDB is a great service for serverless web apps, mobile backends, microservices, and operations that need low-latency data access. However, when you are dealing with demanding workloads and unpredictable peaks, DynamoDB pricing can quickly get out of hand.
In this post, we’ll explain how the DynamoDB pricing model works, and how to optimize DynamoDB storage utilization. We’ll also show how NetApp Cloud Volumes ONTAP can help reduce DynamoDB pricing and avoid overhead.
In this article, you will learn:
- DynamoDB basic concepts
- How DynamoDB pricing works
- Tips for DynamoDB costs optimization
- DynamoDB Pricing Optimization with Cloud Volumes ONTAP
DynamoDB Basic Concepts
Amazon DynamoDB is a NoSQL database service that is designed to run Internet-scale, high-performance applications. It supports both cloud-native and serverless application development. Once you have determined that DynamoDB offers the features you’re looking for in a database service, you need to verify that the pricing matches your budget.
The most basic concepts that you need to know and understand about DynamoDB pricing in AWS are what capacity modes are available and how read and write operations are classified. This is because operations differ between the two capacity modes.
DynamoDB Capacity Modes and Their Impact on Pricing
The capacity modes you can choose from are:
With provisioned capacity, you declare how many read/write operations per second you need ahead of time. Then, you can auto-scale to adjust your levels during application runtime.
This mode is designed for applications with predictable amounts of traffic or which you plan to slowly ramp up traffic for. It enables you to more carefully predict and control your costs based on predictions of resource needs.
When choosing this mode, you should base your decision on what your maximum traffic capacity needs to be. You should also consider how your traffic fluctuates throughout the day. The provisioned mode enables you to provision resources by the hour. If, for example, you have a daily spike, you can create a smart schedule that accounts for this spike and then returns your provisioning to a lower level.
With On-Demand capacity you are charged for use as you run your application. Your workloads can still fluctuate, and your resources will scale accordingly.
This mode is designed for situations with unpredictable traffic if you plan to create new tables with unknown workloads. It enables you to pay only for what you use but can make it more difficult to keep costs in check.
When choosing this mode, you should consider the total number of requests that are made for your application. In particular, you should try to use this mode when your number of requests is small, but your throughput variance is high. This is because on-demand mode pricing is based on request number, not throughput.
Read / Write Operations in DynamoDB
Read and write operations in DynamoDB are billed according to the following table:
|Read Capacity Unit (RCU)
(each supports up to 4KB of data)
|Write Capacity Unit (WCU)
(each supports up to 1KB of data)
|Stream Read Request Unit
(each supports up to 1GB of data)
|One GetRecords API call per unit|
How Does AWS DynamoDB Pricing Work?
The following table shows the pricing breakdown of basic services, including those for which DynamoDB pricing does not depend on the capacity mode. These prices are all for the us-east-1 region. You can see prices for every region on the official pricing page.
(Tables duplicated across regions)
|$0.000975 per rWCU||
$1.875 per million rWCU
|Backup and restore||
(Used when transferring data between regions)
Tips to Optimize Your DynamoDB Costs
When you implement DynamoDB, there are several tips you can apply to optimize your costs. Below are a few to start with.
Use cheaper regions
As long as you are not restricted to specific regions, for example, due to compliance, you can choose regions with cheaper costs. However, keep in mind that this may have an impact on your read/write latency as more remote regions may require several server transfers per request. Currently, the cheapest regions are us-east-1, us-east-2, and us-west-2.
Limit record sizes
DynamoDB uses billing units that are restricted by size. This means that the smaller your requests are, up to a point, the less you are charged. Aiming to keep your records small can help you ensure that each request only consumes the minimal unit needed. It can also help ensure that your storage costs remain as low as possible.
One tip for keeping sizes small is to limit the length of your attribute values and names. Another is to carefully choose data formats. For example, the epoch time format for dates can save size over the ISO format.
Additionally, you should periodically scan your database for unnecessary or orphaned data. While this won’t affect your unit use costs, eliminating this data can boost your performance and reduce storage costs.
Prefer queries over scans
When you are fetching data from DynamoDB, you can use either query or scan methods. Queries use sort and partition keys to locate data directly while scans search your whole table.
While you may sometimes need to scan, using this method is more expensive since you are charged for all rows scanned. In contrast, with a query, you are only charged for the specific items retrieved.
Leverage DynamoDB free tier
AWS offers a free tier you can use to scale up your operations. For DynamoDB, the free tier provides 25 GB of storage, 25 provisioned write capacity units (WCU), and 25 provisioned read capacity units (RCU). You can use these resources for free for as long as 12 months, and reduce your monthly DynamoDB pricing.
DynamoDB Pricing Optimization with Cloud Volumes ONTAP
NetApp Cloud Volumes ONTAP, the leading enterprise-grade storage management solution, delivers secure, proven storage management services on AWS, Azure and Google Cloud. Cloud Volumes ONTAP supports up to a capacity of 368TB, and supports various use cases such as file services, databases, DevOps or any other enterprise workload, with a strong set of features including high availability, data protection, storage efficiencies, Kubernetes integration, and more.
In particular, Cloud Volumes ONTAP helps in addressing database workloads challenges in the cloud, and filling the gap between your cloud-based database capabilities and the public cloud resources it runs on. Cloud Volumes ONTAP can help you centralize DynamoDB resources and optimize storage efficiency, ensuring that you get the lowest possible DynamoDB Pricing.