简体   繁体   中英

CloudFormation: Publish to SNS topic

I wrote a cloudformation template with this resource to create an SNS topic.

"mySNS" : {
   "Type" : "AWS::SNS::Topic",
   "Properties" : {
      "Subscription" : [
         { "Endpoint" : { "Fn::GetAtt": [ "myLambda", "Arn" ] }, "Protocol" : "lambda" }
      ],
      "TopicName" : "mySNS"
   }
}

Is there a way to publish to this SNS topic from within the template? I can't find anything in CloudFormation template reference http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-sns-topic.html .

Short Answer: no

Long Answer / Workaround: AWS CloudFormation is more about defining resources in AWS than actually using them. However, if publishing in this topic is important for your provisioning process I would suggest you create a lambda-backed custom resource . It would be quite simple for the lambda to then publish to the topic.

If you still need help to get it done I can update my answer with a short exemple

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM