Two requests try to create the same DynamoDB business record. Only one should succeed, with no separate read-before-write race. Which operation is appropriate?

Published
  1. Use a different random key for each attempt.
  2. PutItem with an appropriate attribute_not_exists condition on the item key.
  3. GetItem followed by an unconditional PutItem when the earlier read is empty.
  4. Scan the table twice and assume two empty scans prevent concurrent creation.

Comments — 0