Amazon API Gateway HTTP API to Amazon SQS to AWS Lambda

API Gateway → SQS → Lambda

Create an Amazon API Gateway HTTP API that integrates with an Amazon SQS queue.

In this pattern, called "Queue based leveling", a serverless queue is introduced between your API Gateway and your workers, a Lambda function in this case.
The queue acts as a buffer to alleviate traffic spikes and ensure your workload can sustain the arriving load by buffering all the requests durably.
It also helps downstream consumers to process the incoming requests at a consistent pace.

< Back to all patterns

GitHub icon Download this pattern (.zip)

GitHub icon View this pattern on GitHub


Launch Stack

Clone repo

git clone https://github.com/aws-samples/serverless-patterns/cd serverless-patterns/apigw-sqs-lambda-java

Deploy

sam deploy --guided


Testing

See the GitHub repo for detailed testing instructions.

Cleanup

Delete the stack: aws cloudformation delete-stack --stack-name STACK_NAME.
Confirm the stack has been deleted: aws cloudformation list-stacks --query "StackSummaries[?contains(StackName,'STACK_NAME')].StackStatus"

Created by:

lLyas Bakouch

lLyas Bakouch

Senior Solutions Architect, AWS.

Steven Cook

Senior Solutions Architect at AWS.