- Inserting a new record into the “orders” table.
- Updating the “inventory” table to decrement the item count.
With DynamoDB transactions, you can commit all changes as a single atomic operation. If any part of the transaction fails, all changes are rolled back, ensuring that your system remains in a consistent state.

How Transactions Work
Transactions in DynamoDB work by bundling together multiple operations. When a transaction is executed, DynamoDB reserves extra capacity—doubling the usual write and read capacity units. One set is used for preparing the transaction, and another is reserved for committing it. This additional capacity requirement is necessary to ensure that all operations within the transaction are coordinated correctly.Keep in mind that implementing transactions will require additional capacity provisioning compared to non-transactional operations. Plan your capacity accordingly to avoid performance bottlenecks.
Transactional API Calls
DynamoDB provides two primary API calls to manage transactions:- TransactGetItems: Executes one or more GetItem operations in a single transaction.
- TransactWriteItems: Executes one or more DeleteItem, PutItem, or UpdateItem operations together as one atomic transaction.
