Im trying to write a lambda function to add new data to a DynamoDB Table. From reading the docs at:
http://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/DynamoDB/DocumentClient.html#put-property The PUT method: "Creates a new item, or replaces an old item with a new item by delegating to AWS.DynamoDB.putItem()."
Other than doing a check for an object before 'putting' is there a setting or flag to fail the object exists when the PUT is attempted?
I can see in
params -> Expected -> Exists (Bool)
but can't see any documentation on what this does.
What would be the best architecture (or fasted) to prevent an item overwrite?
Query the table first and if no item exists then add the item
or
Attempt to insert the item and on failure because of duplicate entry report this back? (Is there a way to prevent item overwrite?)