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

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 ]

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/

1 Like

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

1 Like