Skip to content

A simple API Gateway that stores inbound API calls for asynchronous remote retrieval

License

Notifications You must be signed in to change notification settings

deckerego/SQSGateway

Repository files navigation

SQS HTTP Gateway

A simple API Gateway in AWS that stores inbound HTTPS calls as SQS FIFO messages for asynchronous remote retrieval. If you need a way to get HTTP requests to a resource behind a firewall or NAT gateway, this might work.

Deploying the Gateway

The gateway exists as a Serverless project with AWS-specific resources. Once you have your API keys for an AWS account, the gateway can be deployed with:

npm ci
serverless deploy --aws-profile <PROFILE>

Sending HTTP Requests

HTTP requests are sent to the SQS Gateway over HTTP POST with any content you wish in the body. An API key is expected as a query parameter in the URL, as in:

https://yourapi.execute-api.yourregion.amazonaws.com/stage/submit?apikey=LONGAUTOGENERATEDKEY

The API key is available in the AWS Secrets Manager and is autogenerated upon deployment.

Retrieving HTTP Requests

A sample Node.JS script is located in the /scripts directory as an example of how you could subscribe to the SQS queue receiving inbound requests. The remote gateway would intercept the request, store the contents as an SQS message, and then allow subscribers polling the queue to fetch them.

API Gateway Stage Settings

The default settings in serverless.yml rate limit the API Gateway Stage to 1 request per second, with 1 concurrent request. Some default web application firewall rules are also applied to the gateway. To modify these settings, tweak serverless.yml or resources/waf.yml as needed.

About

A simple API Gateway that stores inbound API calls for asynchronous remote retrieval

Resources

License

Stars

Watchers

Forks

Packages

No packages published