Reputation: 11
I'm currently implementing a webservice with lambda and api gateway. I don't want to delay the response of the service because it is just a redirection, but in the background I'm doing some actions. Is it possible to return something to the client before the action is finsished ?
Thank you very much
Upvotes: 0
Views: 91
Reputation: 2533
You can do this with Node.js, but the Lambda/API Gateway model is not really designed for this.
What you can do (we do this in our live environments as well) is the following:
Lambda function A is reachable via API Gateway. Lambda A receives a request, saves a "job definition" file in an S3 bucket and sends a response to the user that the request has been received.
Lambda function B is not reachable via the API Gateway, but has the "object created" S3 event trigger. This lambda function is triggered because Lambda A created an object in the bucket and parses the background job.
Upvotes: 1