简体   繁体   English

如何在 CloudFormation 脚本上添加 email 订阅 SNS 主题?

[英]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:所以你的选择是:

  1. 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,您将不得不遍历列表并创建相应的订阅。

  2. 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 来创建所需的订阅。

  3. Instead of custom resource, you could also create macro in CloudFormation.除了自定义资源,您还可以在 CloudFormation 中创建

  4. 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.

相关问题 AWS CloudFormation中如何使用email动态列表订阅SNS主题? - How to use email dynamic list to SNS Topic Subscription in AWS CloudFormation? 是否可以在 cloudformation 模板中使用多个 email 收件人创建 SNS 主题? - Is to possible to create SNS topic with multiple email Recipients in cloudformation template? AWS SNS 主题策略 Cloudformation - AWS SNS Topic Policy Cloudformation 如何取消订阅 email 的 AWS SNS 主题? - How to unsubscribe email from AWS SNS Topic? 如何在AWS SNS订阅下的端点字段中添加多个email地址? - How to add multiple email addresses in the Endpoint Field under AWS SNS Subscription? SNS订阅如何添加SQS消息属性? - How to add SQS message attributes in SNS subscription? 使用 CDK 授予对 SNS 主题订阅上的死信队列的权限 - Using CDK to grant permissions to Dead Letter Queue on SNS Topic Subscription 使用CDK,SNS主题Policy Statement,使用actions:["sns:*"],Cloudformation导致“Policy statement action out of service scope!” - Using CDK, SNS topic Policy Statement, use actions: ["sns:*"], Cloudformation results in "Policy statement action out of service scope!" boto3 SNS:订阅主题时添加过滤策略 - boto3 SNS: Add a filter policy while subscribing to a topic 如何在 Amazon SNS 下订阅多个电话号码到一个主题? - How to subscribe multiple phone numbers to a topic under Amazon SNS?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM