説明
CloudFormation の作成・更新・ロールバックを SNS で通知するには、Ansible タスクに notification_arns を指定します。
想定される影響
別の監視経路がなければ、担当者がデプロイの失敗に気づくまで時間がかかります。
対処方法
運用用 SNS トピックへの発行権限と担当者のサブスクリプションを設定し、実際のスタックイベントを受信できることを確認してください。
例
2 つ目は us-east-1 の stack-events トピックを追加します。実際のトピック ARN、テンプレート URL、パラメーターを指定してください。
変更前
yaml
- name: CloudFormationスタックを作成
amazon.aws.cloudformation:
stack_name: ansible-cloudformation
state: present
region: us-east-1
disable_rollback: true
template_url: https://s3.amazonaws.com/my-bucket/cloudformation.template
template_parameters:
KeyName: jmartin
DiskType: ephemeral
InstanceType: m1.small
ClusterSize: 3
tags:
Stack: ansible-cloudformation
変更後
yaml
- name: CloudFormationスタックを作成
amazon.aws.cloudformation:
stack_name: ansible-cloudformation
notification_arns: arn:aws:sns:us-east-1:123456789012:stack-events
state: present
region: us-east-1
disable_rollback: true
template_url: https://s3.amazonaws.com/my-bucket/cloudformation.template
template_parameters:
KeyName: jmartin
DiskType: ephemeral
InstanceType: m1.small
ClusterSize: 3
tags:
Stack: ansible-cloudformation