passdrill
AWS SAA-C03 · RDS, DynamoDB & Databases · Card 019/024 medium

An order-processing workflow must decrement an inventory item's stock count and create a new order record in the same DynamoDB table as a single all-or-nothing operation, so that a failure partway through never leaves stock decremented without a corresponding order, or vice versa. Which DynamoDB capability provides this, and what is the cost implication of using it?

  1. BatchWriteItem, which guarantees that either every action in the batch succeeds or none of them do
  2. TransactWriteItems, which groups the actions into a single all-or-nothing operation with atomicity, consistency, isolation and durability guarantees, at roughly double the write capacity of the equivalent non-transactional writes
  3. DynamoDB Streams combined with a Lambda function that rolls back the stock decrement if the order record fails to write
  4. Global tables, which apply writes across regions atomically so that either both actions succeed everywhere or neither does
Next card → Shuffle