1

I am planning to use a DynamoDB Stream to do a bunch of task on a very complex single table. The task include actions such as sending notifications, updating other entries in the database and indexing some entries using AWS OpenSearch. I can already see that the Lambda function to handle all of this will end up being massively complex and very hard to maintain. It also feels very wasteful since most actions that would be included in this lambda only apply to very specific stream events and are not required for most others.

My thought was that I could maybe use a StateMachine to split these task up into individual Lambdas and then only run them when they are needed for a certain item in the stream.

So I'm curious if there is any easy way to poll a DynamoDB Stream with a Step Function in the same way you would do with a Lambda.

(PS. I know this could be considered an opinion question, but I would also be curious about anyone's thoughts on this solution. Is it a good idea or bad idea ?)

4
  • The word you are looking for is "poll" not "pole". Also, DynamoDB streams are a push mechanism, not a polling mechanism. Commented Feb 14, 2022 at 15:05
  • 1
    I don't see any way to send DynamoDB streams straight to a Step Function. It looks like you would need to send it to a Lambda function first, then if you don't want to do all the processing in the Lambda function you could push the data to a Step Function invocation. Commented Feb 14, 2022 at 15:05
  • The documentation clearly states AWS Lambda polls the stream and invokes your Lambda function synchronously when it detects new stream records. This makes me think DynamoDB streams are not a "push mechanism" but get polled externally. docs.aws.amazon.com/amazondynamodb/latest/developerguide/… Commented Feb 14, 2022 at 15:25
  • I stand corrected Commented Feb 14, 2022 at 15:31

1 Answer 1

1

The lambda must be unique for specific treatment, this is why the best practice is to split your lambda to many sub components

You can use this architecture for example :

DynamoDB Stream --> Lambda --> Step Function (parralele treatment)

Or use multiple lambdas with SNS fanout like :

DynamoDB Stream --> Lambda --> SNS --> multiple sub ( lambdas)

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

Comments

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.