Which solution will meet these requirements?
Enable transactions for the DynamoDB table. Use the BatchWriteItem operation to update the items.
Use the TransactWriteItems operation to group the changes. Update the items in the table.
Set up a FIFO queue using Amazon SOS. Group the changes in the queue. Update the table based on the grouped changes.
Create a transaction table in an Amazon Aurora DB cluster to manage the transactions. Write a backend process to sync the Aurora DB table and the DynamoDB table.
Explanations:
The BatchWriteItem operation does not support transactions and therefore cannot ensure all-or-nothing changes across multiple items. While it can be used to write multiple items at once, it does not provide the atomicity required for coordinated updates.
The TransactWriteItems operation allows for coordinated, all-or-nothing updates to multiple items in DynamoDB. This operation can perform multiple put, update, or delete actions in a single request, ensuring that either all changes are applied or none at all, thus meeting the requirements for atomic changes in the inventory table.
Using a FIFO queue with Amazon SQS to group changes does not guarantee atomicity for the updates to DynamoDB. The updates would still need to be processed separately, which could lead to partial updates if the process fails partway through, failing to meet the all-or-nothing requirement.
Creating a transaction table in Amazon Aurora and syncing it with DynamoDB adds unnecessary complexity and does not utilize DynamoDB’s built-in transaction capabilities. This approach may involve multiple steps and does not guarantee atomicity across the two different databases.