I am using API Gateway REST API, however I noticed that there is 30 seconds timeout when using Lambda as backend. How can I execute lambda longer than 30 seconds?
One option would be to have a Lambda function behind the API to handle requests asynchronously. This would allow Lambda to immediately respond with a success response 202 (Accepted) to API Gateway. Lambda could then request processing from your internal services for the full duration required (up to 15 minutes). This asynchronous invocation can be done by explicitly adding the X-Amz-Invocation-Type:Event header to the integration request. Please note, by default API Gateway sends request to Lambda back-end Synchronously (RequestResponse) using the default “X-Amz-Invocation-Type:RequestResponse” header.
Other option is to optimize your Integrated backend.
No Comments