[英]How to add email subscription of SNS Topic on CloudFormation Script?
TestTopicSubscription:
Type: AWS::SNS::Subscription
Properties:
Endpoint: testn@email.com
Protocol: email
TopicArn: !Ref TestSnsTopic
How to add subscription for multiple email ids(eg:test1@email.com,test2@email.com) to the above list?如何将多个 email ids(eg:test1@email.com,test2@email.com) 的订阅添加到上面的列表?
There are no loops in CloudFormation, and AWS::SNS::Subscription does not take any lists. CloudFormation 中没有循环, AWS::SNS::Subscription不采用任何列表。
So your choices are:所以你的选择是:
Use AWS CLI or SDK to programmatically create a number of stacks based on a single template.使用 AWS CLI 或 SDK 以编程方式基于单个模板创建多个堆栈。 The template would be parameterized, where the parameter would be your endpoint.
模板将被参数化,其中参数将是您的端点。 Thus, using bash or python, for instance, you would have to iterate over your list and create corresponding subscriptions.
因此,例如,使用 bash 或 python,您将不得不遍历列表并创建相应的订阅。
Creating a custom resource in CloudFormation to take your list of emails and create corresponding subscription.在 CloudFormation 中创建自定义资源以获取您的电子邮件列表并创建相应的订阅。 The resource would be in the form of a lambda function which would use AWS SDK to create needed subscriptions.
该资源将采用lambda function的形式,它将使用 AWS SDK 来创建所需的订阅。
Instead of custom resource, you could also create macro in CloudFormation.除了自定义资源,您还可以在 CloudFormation 中创建宏。
Manually copy-and-paste the subscriptions template, if you have only few of them in a single template.如果单个模板中只有少数订阅模板,请手动复制并粘贴订阅模板。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.