Created
March 25, 2023 10:09
-
-
Save bboure/51a80540492232af893d2ea20a8e6c99 to your computer and use it in GitHub Desktop.
AppSync to SNS with Serverless Framework
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
resolvers: | |
Mutation.doSomething: | |
kind: UNIT | |
request: resolvers/sendMessage.request.vtl | |
response: resolvers/sendMessage.response.vtl | |
substitutions: | |
topicArn: !GetAtt MyTopic.TopicArn | |
dataSource: | |
type: HTTP | |
config: | |
endpoint: 'https://sns.us-east-1.amazonaws.com/' | |
iamRoleStatements: | |
- Effect: Allow | |
Action: | |
- sns:Publish | |
Resource: !GetAtt MyTopic.TopicArn | |
authorizationConfig: | |
authorizationType: AWS_IAM | |
awsIamConfig: | |
signingServiceName: sns | |
signingRegion: !Ref AWS::Region |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#set($message=$util.urlEncode($util.toJson($ctx.args.post))) | |
{ | |
"version": "2018-05-29", | |
"method": "POST", | |
"resourcePath": "/", | |
"params": { | |
"headers": { | |
"content-type": "application/x-www-form-urlencoded; charset=utf-8" | |
}, | |
"body": "Action=Publish&Version=2010-03-31&TopicArn=${topicArn}&Message=${message}" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment