Transactions provide atomicity, consistency, isolation, and durability (ACID) in DynamoDB, across one or more tables within a single AWS account and region
Pricing for transactions is based on the sizes of the items in the transaction.
Two new DynamoDB operations have been introduced for handling transactions
TransactWriteItems, a batch operation that contains a write set, with one or more PutItem, UpdateItem, and DeleteItem operations. TransactWriteItems can optionally check for prerequisite conditions that must be satisfied before making updates. These conditions may involve the same or different items than those in the write set. If any condition is not met, the transaction is rejected. TransactGetItems, a batch operation that contains a read set, with one or more GetItem operations. If a TransactGetItems request is issued on an item that is part of an active write transaction, the read transaction is canceled. To get the previously committed value, you can use a standard read.
Limitations
- Each transaction can include up to 10 unique items or up to 4 MB of data, including conditions.
- Transactions are enabled for all single-region DynamoDB tables and are disabled on global tables by default.
DynamoDB offers multiple read and write options Three options for reads—eventual consistency, strong consistency, and transactional. Two for writes—standard and transactional.
No lock contention, the transation is cancelled and an exception is thrown Items are not locked during a transaction. DynamoDB transactions provide serializable isolation. If an item is modified outside of a transaction while the transaction is in progress, the transaction is canceled and an exception is thrown with details about which item or items caused the exception.
using the cli
aws dynamodb transact-get-items --transact-items ...
aws dynamodb transact-write-items --transact-items ...
IAM policy for trx options When creating an AWS Identity and Access Management (IAM) policy, there are no new permissions for TransactGetItems and TransactWriteItems. Existing DynamoDB UpdateItem, PutItem, DeleteItem, and GetItem actions authorize the use of those operations also within transactions. For example, if an IAM user has only PutItem permission, they can send a transaction with one or more put, but if they add a delete to the write set, it will get rejected because they do not have DeleteItem permission.https://aws.amazon.com/about-aws/whats-new/2018/11/announcing-amazon-dynamodb-support-for-transactions/https://aws.amazon.com/blogs/aws/new-amazon-dynamodb-transactions/