Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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...

like image 220
cocacrave Avatar asked May 22 '26 02:05

cocacrave


1 Answers

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.

like image 182
Matt D Avatar answered May 24 '26 23:05

Matt D



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!