0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

アクセスキー作成から90日経過したらメール通知する

Posted at

前置き

AWSではアクセスキーは定期的にローテーションすることが推奨されています。
今回はアクセスキーが作成されてからメールで通知する方法を備忘として記載します。

やり方①Amazon EventBridge+AWS Config+SNS

Amazon EventBridgeでイベントパターンパターンとして以下を定義

{
  "source": ["aws.config"],
  "detail-type": ["Config Rules Compliance Change"],
  "detail": {
    "configRuleName": ["access-keys-rotated"],
    "newEvaluationResult": {
      "complianceType": ["NON_COMPLIANT"]
    }
  }
}

ターゲットとしてSNSを選択。
この方法だとAWS Configのマネージドルール「access-keys-rotated」が非準拠になった際に以下のようなメールがくるが、すごく見づらい。
image.png

やり方② AWS User Nortificationsの通知機能を使う

イベントルールにAWS Configを選べる。
image.png

フィルター条件で細かくカスタマイズすることも可能。
(下記では「準拠」⇒「非準拠」をトリガーとして設定)

{
  "detail": {
    "configRuleName": [
      "access-keys-rotated"
    ],
    "newEvaluationResult": {
      "complianceType": [
        "NON_COMPLIANT"
      ]
    },
    "oldEvaluationResult": {
      "complianceType": [
        "COMPLIANT"
      ]
    }
  }
}
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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?