You can consider using the following design patterns:
- Use AWS Integration target for API Gateway, so that it will send messages directly to an SQS queue and have Lambda function to be triggered from that queue for message processing. See Amazon API Gateway to SQS to Lambda pattern, for example.
- You can leverage Lambda Asynchronous invocation capability with API Gateway's Lambda Integration as described here: Set up asynchronous invocation of the backend Lambda function.
The difference between option 1 and 2 is that SQS queue for the option 2 is managed internally by Lambda runtime and you have less control over its configuration.
That way, API Gateway will respond to the caller without waiting for Lambda to complete its execution.
- Accepted Answerasked a year ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 3 years ago