Skip to content

Instantly share code, notes, and snippets.

@kenoir
Created December 11, 2014 13:34
Show Gist options
  • Save kenoir/b52c83a7fa2884321129 to your computer and use it in GitHub Desktop.
Save kenoir/b52c83a7fa2884321129 to your computer and use it in GitHub Desktop.
SNS topic with subscriptions from external account.
{
"AWSTemplateFormatVersion": "2010-09-09",
"Description": "Publish or be damned.",
"Parameters": {
"SubscriberPrincipals": {
"Type": "CommaDelimitedList",
"Description": "Account IDs to allow subscription from."
}
},
"Resources": {
"SNSTopic": {
"Type": "AWS::SNS::Topic",
"Properties": {}
},
"SNSTopicPolicy": {
"Type": "AWS::SNS::TopicPolicy",
"Properties": {
"PolicyDocument": {
"Version": "2012-10-17",
"Id": "MyTopicSubscribePolicy",
"Statement": [
{
"Sid": "Allow-other-account-to-subscribe-to-topic",
"Effect": "Allow",
"Principal": {
"AWS": { "Ref" : "SubscriberPrincipals" }
},
"Action": "sns:Subscribe",
"Resource": {
"Ref": "SNSTopic"
}
}
]
},
"Topics": [
{
"Ref": "SNSTopic"
}
]
}
}
},
"Outputs": {
"SNSTopicTopicARN": {
"Value": {
"Ref": "SNSTopic"
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment