DynamoDB Locking, Conditional Writes

Optimistic locking with version number

  • may not be available for nodejs

Atomic counters

idempotence refers to the ability of a system to produce the same outcome, even if the same file, event or message is received more than once.

A conditional write succeeds only if the item attributes meet one or more expected conditions.

you could prevent an UpdateItem operation from modifying an item if one of its attributes has a certain value.

If two lambdas tried to update the same field in dynamoDb, the field would have the last writer’s value.  The earlier writer’s value would be lost.

Conditional writes can be idempotent if the conditional check is on the same attribute that is being updated. This means that DynamoDB performs a given write request only if certain attribute values in the item match what you expect them to be at the time of the request.