How To Make Your DynamoDB Queries ACID Compliant
DynamoDB enables full ACID compliance, here’s how, the pros, cons and limitations
There’s a common misconception that DynamoDB isn’t ACID compliant.
DynamoDB provides eventual consistency by default and write operations are not atomic either by default.
However, DynamoDB does support full ACID transactions.
And it’s important to understand how it works — and where the limitations lie — before writing it off for use cases that require strong guarantees.
Let’s break it down.
What Does ACID Mean?
ACID stands for:
Atomicity
Consistency
Isolation
Durability
These are four critical properties that ensure reliable transactions in databases.
Atomicity: A transaction is an all-or-nothing operation. If one part fails, the entire operation is rolled back.
Consistency: The database moves from one valid state to another. Any transaction will bring the data into a consistent state.
Isolation: Transactions do not interfere with each other, even if they run at the same time.
Durability: Once a transaction is committed, the data is saved — even in the event of a failure.
DynamoDB supports all four of these, but only if you use transactional operations.
DynamoDB’s Transactional APIs
DynamoDB provides two key operations for running transactions:
TransactWriteItems: Used when you want to perform one or more write operations (e.g. PutItem, UpdateItem, DeleteItem) in a single atomic transaction.
TransactGetItems: Used for retrieving multiple items in a strongly consistent and isolated way.
Both of these are designed to ensure that your application logic is safe from partial failures or conflicting writes.
Under the hood, AWS handles all the complexity of locking, isolation, and retry logic to make sure the transaction either fully succeeds or doesn’t change anything at all.
This is true ACID behavior.
The Caveats: Understand the Limits
As with any system, there are trade-offs and constraints to be aware of:
Single Region Only: Transactions only work across tables in the same AWS region. If you use Global Tables, ACID compliance doesn’t extend across regions.
Item and Size Limits: A single transaction can operate on up to 100 items or 4MB of total data. That’s more than enough for most use cases but something to keep in mind.
Secondary Indexes: Even though the base table supports strong consistency with transactions, Global Secondary Indexes (GSIs) do not support strongly consistent reads, even within a transaction.
These are not dealbreakers for most real-world use cases, but they’re important to understand so you can architect your solution accordingly.
Performance and Cost Considerations
DynamoDB’s transactions are powerful, but not free.
Every item you read or write as part of a transaction consumes double the read/write capacity units (RCUs/WCUs) compared to non-transactional operations.
So if you’re running at scale or doing a high volume of transactional reads/writes, this can have a cost impact.
Use them only when needed, like when operations where atomicity and isolation are non-negotiable.
So When Should You Use DynamoDB Transactions?
DynamoDB transactions are a great fit when you’re updating related records and want to ensure they’re always in sync.
Another good use case is when you need to check for conditional logic across multiple items (e.g. ensure two records exist before writing a third).
Also, if your application can tolerate the 100-item limit and operates within a single region.
But if every single operation in your app requires strict ACID compliance, DynamoDB might not be the right tool.
In those cases, a relational database like Aurora or PostgreSQL might make more sense.
Conclusion
DynamoDB is ACID compliant, you just have to use the right APIs.
If you’re already using DynamoDB and need strong guarantees around consistency and atomicity, transactions give you the tools you need without sacrificing its performance and scalability benefits.
Transactions are powerful and useful, just remember to use them wisely.
👋 My name is Uriel Bitton and I’m committed to helping you master Serverless, Cloud Computing, and AWS.
🚀 If you want to learn how to build serverless, scalable, and resilient applications, you can also follow me on Linkedin for valuable daily posts.
Thanks for reading and see you in the next one!