DynamoDB Stream filters comparing values in NewImage and OldImage
1
I have a table MyTable
with count
(numeric) among its fields.
I want my CountListener
function to be triggered each time the value of count
gets updated, for any item in the table.
I've enabled the stream (New and old images) for the table and now I need to write a filter for the stream events in order to invoke CountListener
all and only each time count
changes.
From the docs I see how to write a filter that compares the value of a field with a constant value: I wonder if I can compare the value of count
in NewImage
against the one in OldImage
and trigger the lambda if and only if they're different.
asked 3 months ago8 views
1 Answers
1
Accepted Answer
It is not possible to achieve your goal with Lambda event filtering at the time of writing this for two reasons:
- There is no "numeric not equal" operator
- It is not possible to compare two fields of the stream data with each other.
answered 3 months ago
Relevant questions
DynamoDB Item Insert Limit
asked 2 months agoDynamoDB UpdateItem
Accepted AnswerDynamo DB Kinesis Steams Best Practice
Accepted Answerasked a year agoDynamoDB streams filter with nested fields not working
asked 4 months agoHow to read DynamoDB table using aws lambda function in python?
asked a month agoRowCount for DynamoDB
Accepted Answerasked 3 years agoDynamoDB Stream filters comparing values in NewImage and OldImage
Accepted Answerasked 3 months agoGetting an AccessDeniedException when trying to access (read) a DynamoDB table from a completely different AWS account
asked 2 months agoExtracting tables DynamoDB->S3 : HIVE_BAD_DATA
asked 2 months agoCan lambda know the specific attribute which changed in the dynamo db table update, when a lambda is triggered by dynamo db table update item??
asked 2 months ago
Thank you for your answer.
So, since the code knows whether the "count" field is going to be written, I could add a new (perhaps boolean) field like "updatedCount" set to true when a value for "count" is being set.
Then, the trigger could be activated by a filter like '{"dynamodb": {"NewImage": {"updatedCount": true}}}'. Does it make any sense to you? If not, what would you suggest?