Lawrence Wagerfield
Lawrence Wagerfield

Reputation: 6611

Is it possible for multiple AWS Lambdas to service a single HTTP request?

On AWS, is it possible to have one HTTP request execute a Lambda, which in turn triggers a cascade of Lambdas running in serial, where the final Lambda returns the result to the user?

I know one way to achieve this is for the initial Lambda to "stay running" and orchestrate the other Lambdas, but I'd be paying for that orchestration Lambda to effectively do nothing most of the time, i.e. paying for the time it's waiting on the others. If it were non-lambda code, that would be like blocking (and paying for) an entire thread while the other threads do their work.

Unless AWS stops the billing clock while async Lambdas are "sleeping"/waiting on network IO?

Upvotes: 1

Views: 488

Answers (1)

Chris Williams
Chris Williams

Reputation: 35188

Unfortunately as you've found only a single Lambda function can be invoked, this becomes an orchestrator.

This is not ideal but will have to be the case if you want to use multiple Lambda functions as you're serving a HTTP request, you can either use the Lambda to call a number of Lambda or instead create a Step Function which can can orchestrate the individual steps. You would still need the Lambda to start this, and then poll the status of it before returning the results.

Upvotes: 1

Related Questions