AWS Inspector 実行結果のSNS通知
Inspectorからの実行結果についてSNSで通知して欲しいなぁ。と思っていたら、さすがAWS、デフォルトで用意されていました。
SNS通知に関しては以下のイベントでフィルタリング出来るみたい
- 実行開始
- 実行完了
- 実行ステータスが変更されました
- 報告された結果
実行結果が変わったときに通知が欲しいなーと思ったので、「実行ステータスが変更されました」で試しにやってみた。
実行結果
おや。。。設定時に7通もメールが飛んでくる。
{"template":"arn:aws:inspector:***region***:***AWS Account***:target/***/template/***","newstate":"CREATED","time":"2020-03-12T08:14:32.758Z","event":"ASSESSMENT_RUN_STATE_CHANGED","target":"arn:aws:inspector:***region***:***AWS Account***:target/***"}
{"template":"arn:aws:inspector:***region***:***AWS Account***:target/***/template/***","newstate":"START_DATA_COLLECTION_PENDING","time":"2020-03-12T08:14:32.911Z","event":"ASSESSMENT_RUN_STATE_CHANGED","target":"arn:aws:inspector:***region***:***AWS Account***:target/***"}
{"template":"arn:aws:inspector:***region***:***AWS Account***:target/***/template/***","newstate":"COLLECTING_DATA","time":"2020-03-12T08:14:33.319Z","event":"ASSESSMENT_RUN_STATE_CHANGED","target":"arn:aws:inspector:***region***:***AWS Account***:target/***"}
{"template":"arn:aws:inspector:***region***:***AWS Account***:target/***/template/***","newstate":"EVALUATING_RULES","time":"2020-03-12T09:15:34.773Z","event":"ASSESSMENT_RUN_STATE_CHANGED","target":"arn:aws:inspector:***region***:***AWS Account***:target/***"}
{"template":"arn:aws:inspector:***region***:***AWS Account***:target/***/template/***","newstate":"DATA_COLLECTED","time":"2020-03-12T09:15:33.964Z","event":"ASSESSMENT_RUN_STATE_CHANGED","target":"arn:aws:inspector:***region***:***AWS Account***:target/***"}
{"template":"arn:aws:inspector:***region***:***AWS Account***:target/***/template/***","newstate":"START_EVALUATING_RULES_PENDING","time":"2020-03-12T09:15:34.177Z","event":"ASSESSMENT_RUN_STATE_CHANGED","target":"arn:aws:inspector:***region***:***AWS Account***:target/***"}
{"template":"arn:aws:inspector:***region***:***AWS Account***:target/***/template/***","newstate":"COMPLETED","time":"2020-03-12T09:15:47.927Z","event":"ASSESSMENT_RUN_STATE_CHANGED","target":"arn:aws:inspector:***region***:***AWS Account***:target/***"}
newsstateからわかる通り「実行ステータスが変更」って調査時の実行ステータスという意味で実行結果内容の変更時の通知って意味ではないのね。
- "newstate":"CREATED"
- "newstate":"START_DATA_COLLECTION_PENDING"
- "newstate":"COLLECTING_DATA"
- "newstate":"EVALUATING_RULES"
- "newstate":"DATA_COLLECTED"
- "newstate":"START_EVALUATING_RULES_PENDING"
- "newstate":"COMPLETED"
もっといい感じにフィルタリング出来ないかと思って、少し調べてみたら、重要度別に通知してくれるの調べてくれている人がいました。
https://qiita.com/tomoki_s/items/30550f7fb569f6fb4ce9
これで十分そうなので、今度試してみよう。