The Resources and Output sections of the template can include following:
Resources:
SNSTopic:
Type: AWS::SNS::Topic
Properties:
DisplayName: 'My first SNS topic'
TopicName: my-first-sns-topic-cf
Output:
SNSTopicARN:
Value: !Ref SNSTopic
Export:
Name: "SNSTopicARN"
SNSTopicName:
Value: !GetAtt SNSTopic.TopicName
Export:
Name: "SNSTopicName"
You can also specify a list of subscriptions. However, in general practice subscriptions are added dynamically and hence we will demonstrate them using AWS CLI commands. You may also include a template format version and a description in the template file.
If the create stack command completes successfully, the stack description command's output will contain an Output section, as follows: