Mapping template for API Gateway with SNS integration

Provides a mapping template for API Gateway and SNS integration

This snippet can be used to publish messages to an existing SNS topic.
When creating the integration, ensure to have the below configuration to use the mapping template:
1. For Path override the value must be given as '/'
2. The header 'Content-Type' should have the value 'application/x-www-form-urlencoded' (include the single quotes in the value)
3. IAM role with appropriate sns:publish IAM permission

Use the following mapping template

#set($topic="arn:aws:sns:<region>:<account-number>:<topic-name>")
Action=Publish&TopicArn=$util.urlEncode($topic)&Message=$input.json('$')
                                


Created by:

Pallavi Bhat

Pallavi Bhat

Pallavi is a Cloud Support Enginner focusing on serverless at Amazon Web Services.

Follow on LinkedIn