0

I have a DynamoDB table whose items have these attributes: id, user, status. Status can take values A or B.

  1. Is it possible to trigger a lambda based on only the value of attribute 'status' ?

Example, trigger the lambda when a new item is added to DDB with status == A or when the status of an existing item is updated to A. (I am looking into DynamoDB streams for achieving this, but I have not come across an example where anyone is using it for this use case.)

  1. Is it possible to monitor a DDB based on value of a certain attribute ?

Example, when status == B, I don't want to trigger lambda, but only emit a metrics for that row. Basically, I want to have a metrics to see how many items in the table have status == B at a given point.

If not from DynamoDB , are the above two possible for any other storage type ?

1 Answer 1

3

Yes, as your initial research has uncovered, this is something you'll want to use DynamoDB Streams for.

You can trigger a lambda function based on an item being written, updated, or removed from Dynamo DB, and you can configure your stream subscription to filter on only attributes and values you care about.

DynamoDB recently introduced the ability to filter stream events before invoking your function, you can read more about how that works and how to configure it here

For more information about DynamoDB Stream use cases, this post may be helpful.

Sign up to request clarification or add additional context in comments.

2 Comments

Thank you for confirming. These links are very useful. Learned something new today !
You're welcome! If I've answered your question, please mark it as accepted so others can find it. Thanks!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.