DynamoDB if_not_exists on UpdateItem
<p>I am trying a very simple scenario.  I need to maintain a counter per row. I am using UpdateItem to do upsert instead of insert.</p>

<ol>
<li>If row does not exist, it should just set the value of counter column</li>
<li>If row exists, it should update the counter. </li>
</ol>

<p>2 works fine, but for 1 it complains that attribute does not exist.  I tried if_not_exists clause without any help.  Can someone please point me to the right direction?  Also share how to use if_not_exists clause for UpdateItem</p>