'Find whether the value has been updated or inserted in Dynamodb?

I am using updatedItem() function which is either inserting or updating values in Dynamodb. If values are updating I want to fetch those items and invoke a new lambda function. How can I achieve this?



Solution 1:[1]

Don't think previously accepted answer works. The return Attributes never returned the partition/sort keys, whether an item was updated or created.

What worked for me was to add ReturnValues: UPDATED_OLD. If the returned Attributes is undefined, then you know that an item was created.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Http417