I am having a use case where I need to understand the difference between NEW_IMAGE
and OLD_IMAGE
on dynamoDB streams.
According to
https://aws.amazon.com/blogs/database/dynamodb-streams-use-cases-and-design-patterns/
DynamoDB Streams supports the following stream record views:
KEYS_ONLY—Only the key attributes of the modified item
NEW_IMAGE—The entire item, as it appears after it was modified
OLD_IMAGE—The entire item, as it appears before it was modified
NEW_AND_OLD_IMAGES—Both the new and the old images of the item
I can not register to listen on IMAGE_DIFFERENCE
or similar.
So, what is the best way achieve that (an example preferably in JavaScript/TypeScript) ?
your only option is to listen on NEW_AND_OLD_IMAGES
and diff them yourself. if AWS were to implement a IMAGE_DIFFERENCE
like view, it would need some special notation to tell you which entries were deleted and which were added. that processing would add to the latency associated with the streams and may not be suitable for enough use-cases to make building it feasible.