Search code examples
amazon-dynamodb

Are DynamoDB conditional writes strongly consistent?


Suppose that a given table already contains the following key value pair:

"abc" => { i: 1, v: "foo" }

Then, two clients issue conflicting concurrent conditional writes. Client 1 writes:

"abc" => { i: 2, v: "bar1" } if i == 1

Client 2 writes:

"abc" => { i: 2, v: "bar2" } if i == 1

Then, is it guaranteed that at most one client's write operation will succeed?


Solution

  • Yes, that's exactly the use case they're designed for.

    Actually the official doc Conditional writes says

    Conditional writes check their conditions against the most recently updated version of the item.

    You can also see an example in the doc above.