Intuition vs. Reality: Understanding Cloud Cost Traps
A real-world example of why cloud pricing can be unintuitive
As software developers, we often have an intuitive understanding of infrastructure costs and the expenses associated with certain backend operations.
Right?
That may have been true in the pre-public cloud era and is still partially true for hyperscalers in the public cloud, such as AWS.
However, the problem is that many cloud resources are not billed “per item” (e.g., “per DynamoDB table”) but rather per API operation. And here’s where things become unintuitive: some API operations are not as obvious as they seem.
Let me give you an example:
There was a DynamoDB table with a lot of data, used for testing purposes, and it needed to be emptied regularly.
Unlike relational databases such as PostgreSQL, DynamoDB does not support a simple “DELETE * FROM table” operation. Instead, you must delete items in batches—up to 25 items at a time. This means looping through the table and deleting items in batches until it’s empty.
Sounds simple and cheap, right?
Not quite. If you perform a large number of write, read, or delete operations in a short burst, DynamoDB may throw throttling exceptions. But shouldn’t it scale effortlessly and almost infinitely, like the name “DynamoDB” suggests?
Yes, it does—but gradually, over time. While it scales to handle consistent high usage, it has limitations when dealing with sudden burst loads.
This can be mitigated by purchasing provisioned capacity to prepare the table for heavy usage. But this approach is inefficient—why pay for provisioned capacity all the time if you only empty the table once a week?
And here’s the next gotcha: in DynamoDB, you pay for each write and read operation. So, is deleting items free?
Unfortunately, it’s not. A delete operation counts as a write operation. Deleting a lot of items can quickly become expensive.
This highlights why relying on your intuition from on-premises systems can be risky when estimating costs in the public cloud.
Pro tip: If you run into this specific issue, there’s a loophole—deleting an entire DynamoDB table is free. So, if you want to delete all items from a table without incurring write operation costs, just delete the table and recreate it with the same settings.
And now you: What’s the most unintuitive cloud cost you’ve run into?