How to prevent a DynamoDB item being overwritten if an entry already exists : <p>Im trying to write a lambda function to add new data to a DynamoDB Table. 
From reading the docs at: </p>

<p><a href="http://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/DynamoDB/DocumentClient.html#put-property" rel="noreferrer">http://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/DynamoDB/DocumentClient.html#put-property</a>
 The PUT method: "Creates a new item, or replaces an old item with a new item by delegating to AWS.DynamoDB.putItem()."</p>

<p>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?</p>

<p>I can see in </p>

<pre><code>params -&gt; Expected -&gt; Exists (Bool)
</code></pre>

<p>but can't see any documentation on what this does. </p>

<p>What would be the best architecture (or fasted) to prevent an item overwrite? </p>

<pre><code>Query the table first and if no item exists then add the item
</code></pre>

<p>or</p>

<pre><code>Attempt to insert the item and on failure because of duplicate entry report this back? (Is there a way to prevent item overwrite?)
</code></pre>
