I have two lambdas. Lambda A is triggered once an SQS is populated with messages. I want Lambda B to execute once Lambda A is done executing. How can I do this? Lambda A will have multiple invocations running at the same time, does that make a difference?
2 Answers
To do this, you'd need to trigger the Step Function directly from a lambda. As far as I know, you can't trigger Step Functions directly from SQS.
So, either
If Lambda A is triggered by something else than SQS, trigger your Step Function instead. It will then run Lambda A and Lambda B depending on how you set it up.
If Lambda is triggered by SQS, you make a third lambda (Lambda 0), triggered by SQS, whose sole purpose is to in turn trigger your Step Function (which will run Lambda A then Lambda B) or you directly trigger Lambda B from Lambda A (in which case, Step Functions are pointless and you should rather go with SQS / SNS).
A note on this; one thing Step Functions cannot do out of the box is, for example execute Lambda B only once all Lambda A invocations are done. It will act on a per execution basis.