Sns topic in events, but how to reference its arn?

aws

#1

Following the events with sns, I got below sample codes to create sns topic automatically.

functions:
2  dispatcher:
3    handler: dispatcher.dispatch
4    events:
5      - sns: dispatch

But now I am confused on how to get its arn?

Will below code work?

"Fn::GetAtt": [ "dispatch", Arn ]


#2

I think it’s Ref: SNSTopicDispatch.

The ARN for an SNS Topic can be found using Ref - see https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-sns-topic.html.

The Serverless Framework docs say the topic will be named SNSTopic{normalizedTopicName} - see https://serverless.com/framework/docs/providers/aws/guide/resources/


#3

have look into .serverless/cloudformation-template-update-stack.json to see how the serverless framework is creating the names