简体   繁体   English

CloudFormation:发布到SNS主题

[英]CloudFormation: Publish to SNS topic

I wrote a cloudformation template with this resource to create an SNS topic. 我使用此资源编写了一个cloudformation模板来创建SNS主题。

"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? 有没有一种方法可以从模板中发布到此SNS主题? I can't find anything in CloudFormation template reference http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-sns-topic.html . 我在CloudFormation模板参考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. 长答案/解决方法:AWS CloudFormation不仅仅是在AWS中定义资源,还比实际使用它们更多。 However, if publishing in this topic is important for your provisioning process I would suggest you create a lambda-backed custom resource . 但是,如果在本主题中发布对您的设置过程很重要,则建议您创建一个由lambda支持的自定义资源 It would be quite simple for the lambda to then publish to the topic. 然后,lambda发布到该主题将非常简单。

If you still need help to get it done I can update my answer with a short exemple 如果您仍然需要帮助以完成任务,我可以举一个简短的例子来更新我的答案

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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