LoginSignup
0
0

More than 1 year has passed since last update.

CloudWatchで通知抑制は出来るのか?

Posted at

やりたいこと

CloudWatchAlarmで監視しているインスタンスAがCPU高騰した際に、
CloudWatchAlarmのSNS(Eメール)にて、
初回のみ指定のメールアドレスに通知し、2回目以降は通知さない。

結論、できない!

サポート回答

CloudWatchAlarmには上記要件を実現する機能は存在しておらず、
初回のみアラームのアクションを実行するといった対応は出来かねます。

対応策

サポート回答

CloudWatchAlarmのDisableAlarmAction API(AWS CLIのdisable-alarm-actionコマンド)にて、
アクションの実行を無効化をする。

具体的には?

サポート回答

CloudWatchAlarmの通知先をSNSではなくLambdaを選択し、
DisableAlarmActionを実行したうえで、次回以降のアクションを無効化する方法。
CloudWatchAlarm --> SNS --> Lambda --> SNS --> Eメール

1つ目と2つ目のSNSでは異なるトピックを選択する

  • 1つ目
    トピックのサブスクリプション:Lambda
  • 2つ目
    トピックのサブスクリプション:Eメール

Lambda関数を作成しSNSへ通知しつつ、DisableAlarmAction APIアクションを実行したうえで、
CloudWatchAlarmのアクションを無効化する処理を実装する。

参考ドキュメント

アラームを無効または有効にするには、DisableAlarmActions および EnableAlarmActions API アクション、または AWS CLI の disable-alarm-actions および enable-alarm-actions コマンドを使用します。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0