I have a set (~1.000.000) of devices that can send messages, each device has an ID and can send multiple messages. A subset (~10.000) of the devices should be able to use my service and there IDs are put in a whitelist (DynamoDB table). Given a constant stream of messages I would like only the once in the whitelist to be persisted in a DynamoDB table.
The things I have been looking at are as follows:
- Naive way is to do the filtering in code when the lambda writes data to DynamoDB, not sure how well this will scale given that I first need to query the whitelist table to check which messages I then can write.
- What I would like to do use use DynamoDB conditional writes (or if there is some other smart functionality) to specify "write this item to the table only if it exist in the whitelist" and let the DynamoDB engine take care of the filtering.
My question is if there is some smart way to do this in DynamoDB?