

翻訳は機械翻訳により提供されています。提供された翻訳内容と英語版の間で齟齬、不一致または矛盾がある場合、英語版が優先します。

# コスト異常検出での AWS ユーザー通知の使用
<a name="cad-user-notifications"></a>

[AWS User Notifications](https://docs.aws.amazon.com/notifications/latest/userguide/what-is-service.html) を使用して、コスト異常検出イベントについて通知する配信チャネルを設定できます。指定したルールにイベントが一致すると、通知を受け取ります。イベントの通知は、Eメール、Amazon Chime、Microsoft Teams、Slack などの[チャットアプリケーション内の Amazon Q Developer](https://docs.aws.amazon.com/chatbot/latest/adminguide/what-is.html)、または [AWS Console Mobile Application](https://docs.aws.amazon.com/consolemobileapp/latest/userguide/what-is-consolemobileapp.html) のプッシュ通知など、複数のチャネルで受け取ることができます。 AWS ユーザー通知コンソールの[コンソール通知センター](https://console.aws.amazon.com/notifications/)を使用して通知を表示することもできます。

AWS ユーザー通知は集約もサポートしているため、特定のイベント中に受け取る通知の数を減らすことができます。詳細については、[AWS User Notifications ユーザーガイド](https://docs.aws.amazon.com/notifications/latest/userguide/what-is-service.html)を参照してください。

 AWS ユーザー通知を使用するには、適切な AWS Identity and Access Management (IAM) アクセス許可が必要です。IAM アクセス許可の設定について詳しくは、**AWS User Notifications ユーザーガイド の [Creating a notification configuration](https://docs.aws.amazon.com/notifications/latest/userguide/getting-started.html#getting-started-step1) を参照してください。

## 例: `Anomaly Detected` の EventBridge イベント
<a name="cad-user-notifications-example"></a>

以下は、`Anomaly Detected` の一般化されたサンプルイベントです。 AWS ユーザー通知を使用して EventBridge イベント (このイベントなど) をサブスクライブできます。

```
{
    "version": "0",
    "id": "<id>", // alphanumeric string
    "source": "aws.ce",
    "detail-type": "Anomaly Detected",
    "account": "<account ID>", // 12 digit account id.
    "region": "<region>", // Cost Anomaly Detection home region.
    "time": "<date>", // Format: yyyy-MM-dd'T'hh:mm:ssZ
    "resources": [ 
         "arn:aws:ce::123456789012:anomalymonitor/abcdef12-1234-4ea0-84cc-918a97d736ef"
    ],
    "detail": {
         "accountName": "<account name>",
         "anomalyEndDate": "2021-05-25T00:00:00Z",
         "anomalyId": "12345678-abcd-ef12-3456-987654321a12",
         "anomalyScore": { 
            "currentScore": 0.47,
            "maxScore": 0.47
         },
         "anomalyStartDate": "2021-05-25T00:00:00Z",
         "dimensionValue": "<dimension value>", // service name for AWS Service Monitor
         "feedback": "string",
         "impact": {
            "maxImpact": 151,
            "totalActualSpend": 1301,
            "totalExpectedSpend": 300,
            "totalImpact": 1001,
            "totalImpactPercentage": 333.67
         },
         "rootCauses": [ 
            {
                "linkedAccount": "<linked account ID>", // 12 digit account id.
                "linkedAccountName": "<linked account name>",
                "region": "<region>",
                "service": "<service name>", // AWS service name
                "usageType": "<usage type>", // AWS service usage type
                "impact": {
                    "contribution": 601,
                }
            }
        ],
        "accountId": "<account ID>", // 12 digit account id.
        "monitorArn": "arn:aws:ce::123456789012:anomalymonitor/abcdef12-1234-4ea0-84cc-918a97d736ef",
        "monitorName": "<your monitor name>",
        "anomalyDetailsLink": "https://console.aws.amazon.com/cost-management/home#/anomaly-detection/monitors/abcdef12-1234-4ea0-84cc-918a97d736ef/anomalies/12345678-abcd-ef12-3456-987654321a12"
    }
}
```

## イベントのフィルタリング
<a name="cad-user-notifications-filter"></a>

 AWS ユーザー通知コンソールで使用できるフィルターを使用するか、JSON コードから独自の EventBridge フィルターを作成する場合は特定のプロパティを使用して、サービスと名前でイベントをフィルタリングできます。

**Topics**
+ [例: インパクトでフィルタリングする](#example-filter-by-impact)
+ [例: サービスディメンションでフィルタリングする](#example-filter-by-service-dimension)
+ [例: コスト配分タグでフィルタリングする](#example-filter-by-cost-allocation-tag)
+ [例: リージョンの根本原因でフィルタリングする](#example-filter-by-region-root-cause)
+ [例: 複数の基準でフィルタリングする](#example-filter-composition)

### 例: インパクトでフィルタリングする
<a name="example-filter-by-impact"></a>

次のフィルターを使用すると、合計インパクトが 100 USD を超え、インパクト率が 10% を超える異常が取得されます。

```
{
    "detail": {
        "impact": {
            "totalImpact": [{
                "numeric": [">", 100]
            }],
            "totalImpactPercentage": [{
                "numeric": [">", 10]
            }]
        }
    }
}
```

### 例: サービスディメンションでフィルタリングする
<a name="example-filter-by-service-dimension"></a>

次のフィルターは、 AWS サービスモニターによって検出された EC2 サービス固有の異常をキャプチャします。

```
{
    "detail": {
        "dimensionValue": ["Amazon Elastic Compute Cloud - Compute"],
        "monitorName": ["aws-services-monitor"]
    }
}
```

### 例: コスト配分タグでフィルタリングする
<a name="example-filter-by-cost-allocation-tag"></a>

次のフィルターを使用すると、ディメンションコスト配分タグモニターによって検出されたフロントエンドアプリケーションチームの異常が取得されます。

```
{
  "detail": {
    "dimensionValue": ["ApplicationTeam:Frontend"],
    "monitorName": ["dimensional-CAT-monitor"]
  }
}
```

### 例: リージョンの根本原因でフィルタリングする
<a name="example-filter-by-region-root-cause"></a>

次のフィルターを使用すると、米国東部 (バージニア北部) リージョンで根本原因がある異常が取得されます。

```
{
  "detail": {
    "rootCauses": {
      "region": ["us-east-1"]
    }
  }
}
```

### 例: 複数の基準でフィルタリングする
<a name="example-filter-composition"></a>

次の複合フィルターを使用すると、米国東部 (バージニア北部) リージョンで、合計 100 USD を超えるインパクト、10% を超えるインパクト、根本原因を持つフロントエンドアプリケーションチームの異常が取得されます。

```
{
  "detail": {
    "dimensionValue": ["ApplicationTeam:Frontend"],
    "monitorName": ["dimensional-CAT-monitor"],
    "impact": {
        "totalImpact": [{ "numeric": [">", 100] }],
        "totalImpactPercentage": [{ "numeric": [">", 10] }]
    },
    "rootCauses": {
        "region": ["us-east-1"]
    }
  }
}
```