【问题标题】:Alternative to updating SNS subscriptions using AWS CloudFormation使用 AWS CloudFormation 更新 SNS 订阅的替代方法
【发布时间】:2015-12-29 06:10:27
【问题描述】:
有一个 AWS CloudFormation 堆栈,它定义了一个 SNS 主题和一个 SNS 订阅。在另一个 Ansible 任务中,我想更新另一个订阅,但这不可能,因为无法更新 SNS 订阅。
使用 Ansible 来执行 CloudFormation。有哪些替代方案?
- 将 AWS CLI 与 Ansible 合并,然后执行包含 AWS CLI 内容的播放?
- 使用
boto 在Ansible 中创建自定义模块?但这会很困难,因为我应该存储 SNS ARN 并将其提供给自定义模块。
【问题讨论】:
标签:
amazon-web-services
ansible
amazon-cloudformation
aws-cli
【解决方案1】:
Ansible v2.0 添加了对 sns_topic 模块的支持。您可以提供现有 SNS 主题的名称或 ARN 以进行融合。您可能还想将 purge_subscriptions 设置为 False,这样就不会删除任何现有订阅。
- name: Update SNS topic subscriptions
sns_topic:
name: "my-topic"
purge_subscriptions: False
subscriptions:
- endpoint: "some-email@example.com"
protocol: "email"
http://docs.ansible.com/ansible/sns_topic_module.html