0
votes

We are encountering a situation where if we have a table globally replicated but also use the tables stream to process records on insert/update events.

Ex. We have a table replicated between us-east-1 and us-west-2 with a lambda connected to each tables stream in their region. When an update is performed in the us-east-1 table the us-west-2 lambda is invoked with the updated record. The problem is we need to not process the record replicated to us-west-2, we are using version 2019 of dynamodb global tables so there are no metadata or additional fields that help to do this validation.

Anyone knows how to mitigate this issue?

1
You might consider adding a field to the data that is the region where the record was created. You could then look at that in the stream handler and only process it if the region matched the region that function is running in. - Jason Wadsworth
@Jason Wadsworth Thanks for the response, I understand the approach you are suggesting, for this to be implemented it requires changes in all the places where create/updates to dynamo are made, do you know another strategy that not requires changes in the insert logic of the records? - Esteban Aristizábal
Not to the best of my knowledge. The stream record is just a reflection of what is in the table. It doesn't know how it got there. - Jason Wadsworth

1 Answers

1
votes

Accepted answer: The approach I typically recommend for this is to add your own attribute which records the region where the most recent change was made. Then, your Lambda function which processes the stream records ignores any record for which the region identification is not local.