cocacrave
cocacrave

Reputation: 2633

Invoke AWS Lambda function when multiple Lambda function is done

What is the best way to invoke aws lambda function when multiple lambda functions have successfully finished?

So for example, LambdaA should run when LambdaB1, LambdaB2, ... LambdaBn have successfully returned success. Also, the last LambdaB function is not guaranteed to finish last...

Upvotes: 3

Views: 1220

Answers (1)

Matt D
Matt D

Reputation: 3506

To answer your specific question, you need to use JavaScript Promises (I'm assuming you are using NodeJS) in your Lambda function. When all of the promises are fulfilled, you can proceed.

However, I do not recommend doing it that way, as your initial Lambda function is sitting idle, and being billed, waiting for the responses from the other functions.

IMO, the best way of achieving this parallel execution is using AWS Step Functions. Here you map out the order of events, and you will want to use Parallel States to make sure all tasks are complete before proceeding.

Upvotes: 3

Related Questions