I have a very common use case that need sync 2 dynamoDB tables. The logic flow would be the following.
Right now, My thinking is to enable stream on Requests table. When ever a request is finished, it will trigger a lambda function to check if all the requests are finished.
I have read a lot of documents. And find many limitations of this approach:
So, I think I have to scan the requests table each time when a lambda function is triggered. Will this approach have to much overhead?
I am also open to all other solutions that could solve this problem. I am not sure if I follow the best practice here.
I think you can solve it by using another DynamoDB server.
You can create a separate table in DynamoDB:
FinishedTasks JobId - partition key - id of a job FinishedRequestId - sort key - id of a finished request
Every lambda job would do the following:
In this case you have an idempotent task (it does not matter if you override an item in the FinishedTasks twice)
Of course you need to remove old items from FinishedTasks. To can use the TTL feature to automatically remove old items.