説明
CloudFormationは、スタックの作成、更新、ロールバックなどの状態変更をSNSトピックに通知できます。通知や代替の監視手段がなければ、デプロイの問題の発見が遅れるおそれがあります。
想定される影響
デプロイ失敗の確認や担当者への連絡に時間がかかる場合があります。
対処方法
通知が必要な場合はnotification_arnsにSNSトピックのARNを指定し、発行権限、サブスクリプション、通知の受信を確認してください。
例
以下はSNS通知先を追加する例です。トピック、テンプレート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