Making Your Amazon DynamoDB Database Cheaper

How to make your DynamoDB database the cheapest database you will ever use.

Read on Beehiiv | Oct 13th, 2024

Welcome to The Cloud Economist!

Last week I summarized several key strategies for reducing AWS CloudWatch costs, including analyzing and deleting unnecessary logs, setting appropriate retention periods, and optimizing log structures to minimize long-term expenses.

I shared a few curated articles with actionable tips to reduce common CloudWatch cost pitfalls (most of these are not obvious!).

If you missed that you can read it here.

In the question of the week, I asked “How does optimizing log ingestion patterns impact CloudWatch costs?

Answer:

Optimizing log ingestion patterns can lead to significant cost savings by reducing the volume of data ingested and minimizing processing overhead.

Here are some strategies you can implement:

  • Use batch ingestion instead of real-time streaming for non-critical logs

  • Implement client-side filtering to send only relevant log data

  • Utilize log aggregation techniques to combine multiple log entries before ingestion

This week I’ll share with you strategies I use, and other DynamoDB professionals use to greatly reduce their database monthly costs.

Here are the best articles I’ve found on cloud cost savings this week, summarized.

How to make DynamoDB cheaper by Borislav Stoilov.

Using DynamoDB correctly can lead to significant cost savings

In this article, Borislav explains how switching from ElasticSearch to DynamoDB resulted in a 250x reduction in monthly costs.

The article also explains that DynamoDB costs are primarily driven by write operations (WCUs) and storage, it offers tips to reduce expenses through efficient table design, using conditional writes instead of transactions, setting appropriate retention policies, and avoiding costly operations like scans.

Proper key naming, using TTL, and batch operations are also recommended for cost optimization.

He also briefly discusses the single table design (which I teach a lot about).

This article shares 5 strategies to reduce your DynamoDB costs, these are:

  1. Choosing Lower Cost Regions

  2. Setting TTLs on temporary data

  3. Keep attribute names short

  4. Use infrequent access tables when possible

  5. Don’t store large objects

Delve into the details on how to implement these in the 4-minute read piece above.

I’ve also written a lot about an effective method of reducing costs using Projection Expressions, here.

Reducing costs in DynamoDB starts with understanding how DynamoDB charges work.

Alex Debrie explains how DynamoDB pricing works by breaking down costs into three main areas:

  • read consumption

  • write consumption

  • storage.

He also provides guidance on modeling costs effectively when you are designing your table data.

“The strongest point I want to emphasize is that you should use the predictability and legibility of DynamoDB to your advantage. Use it to understand whether an access pattern will be cost-effective. Use it to weigh the tradeoffs of different approaches to DynamoDB. And, yes, use it to understand when DynamoDB might not be the right fit for a particular use case.“

One Tip on Cloud Cost Savings

The most effective method on saving money in DynamoDB costs that I’ve seen is with the single table design. I’ve seen case studies where a customer drastically reduced their DynamoDB bill to a insignificant amount just from using a single table instead of multiple.

If you are using multiple DynamODB tables in your application, this can potentially save you hundreds of dollars a month.

I teach a lot about the single table design and invite you to read this article where I explain how to use it in a real-life e-commerce application.

This Week’s Question

How can TTLs save you a significant amount of money in DynamoDB?

Send in your answers or check back here next Sunday for a ver interesting answer!

Until next week.

The Cloud Economist