Send customer headers from Amazon API Gateway to Amazon SQS

Amazon API Gateway → Amazon SQS

Amazon API Gateway (HTTP) to Amazon Simple Queue Service (SQS) for passing custom http headers as message attributes.

This pattern enables you to pass custom HTTP headers as message attributes when sending messages from Amazon HTTP API Gateway to an Amazon SQS queue. The headers can be configured either as static values or dynamically passed from the incoming request headers. In the default configuration, the message attribute name is set as 'MessageAttribute1' which maps to the header name 'header1' in the integration request mapping. You can customize these message attribute, header names and static values, according to your requirements by updating the requestParameters section in the SqsIntegration configuration within your SAM template. You can set the name for API Gateway and the SQS queue.

< 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/custom-http-headers-to-sqs-message-attributes-using-http-api-gateway

Deploy

sam deploy


Testing

See the GitHub repo for detailed testing instructions.

Cleanup

Delete the stack: sam delete

Created by:

Annangarachari R

Annangarachari R

Serverless Enthusiast

Follow on LinkedIn