Amazon API Gateway to Amazon SNS to Amazon SQS

API Gateway → SNS → SQS

Create an Amazon API Gateway API that integrates with Amazon SNS and Amazon SQS

This CDK application demonstrates how to set up a topic-queue-chaining pattern using Amazon SNS and Amazon SQS behind an Amazon API Gateway. This architecture helps in setting up a highly scalable API that can consume messages/events, fan them out and process them asynchronously.
This stack deploys an Amazon API Gateway REST API that publishes requests to an SNS Topic. The SNS topic fans out these requests to 2 SQS Queues. Requests in each of these queues are processed by Lambda functions. These functions log the requests to the console [CloudWatch Logs groups].

< Back to all patterns

GitHub icon Download this pattern (.zip)

GitHub icon View this pattern on GitHub


Clone repo

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

Deploy

cdk deploy


Testing

See the repo for detailed testing notes.

Cleanup

1. Delete the stack: npx cdk destroy.
2. Confirm the stack has been deleted: aws cloudformation list-stacks --query "StackSummaries[?contains(StackName,'STACK_NAME')].StackStatus".
3. You see a message confirming DELETE_COMPLETE.

Created by:

Hariram Ronda

Hariram Ronda

Senior Cloud Application Architect @ AWS Professional Services.

Follow on LinkedIn