I am trying to use DynamoDB operation BatchWriteItem, wherein I want to insert multiple records into one table.
This table has one partition key and one sort key.
I am using AWS lambda and Go language.
I get the elements to be inserted into a slice.
I am following this procedure.
Create
PutRequeststructure and add AttributeValues for the first record from the list.I am creating
WriteRequestfrom thisPutRequestI am adding this
WriteRequestto anarray of WriteRequestsI am creating
BatchWriteItemInputwhich consists ofRequestItems, which is basically a map of Tablename and the array ofWriteRequests.
After that I am calling BatchWriteItem, which results into an error:
Provided list of item keys contains duplicates.
Any pointers, why this could be happening?