

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

# Amazon EventBridge による S3 オブジェクトスキャンのモニタリング
<a name="monitor-with-eventbridge-s3-malware-protection"></a>

*Amazon EventBridge* は、アプリケーションをさまざまなイベントソースのデータに簡単に接続できるようにするサーバーレスイベントバスサービスです。EventBridge は、独自のアプリケーション、Software-as-a-Service (SaaS) アプリケーション、および AWS のサービスからリアルタイムデータのストリームを配信し、そのデータを Lambda などのターゲットにルーティングします。これにより、サービスで発生したイベントをモニタリングし、イベント駆動型アーキテクチャを構築できます。詳細については、「[Amazon EventBridge ユーザーガイド](https://docs.aws.amazon.com/eventbridge/latest/userguide/)」を参照してください。

Malware Protection for S3 で保護されている S3 バケットの所有者アカウントとして、GuardDuty は次のシナリオのときに EventBridge 通知をデフォルトのイベントバスに発行します。
+ 保護されたバケットのいずれかで **Malware Protection プランのリソースステータス**が変更されます。さまざまなステータスについては、「[保護されたバケットのステータスの表示と理解](malware-protection-s3-bucket-status-gdu.md)」を参照してください。

  リソースステータスに対して Amazon EventBridge (EventBridge) ルールを設定する方法については、「[Malware Protection プランのリソースステータス](#resource-status-malware-protection-s3-ev)」を参照してください。
+ **S3 オブジェクトスキャンの結果**がデフォルトの EventBridge イベントバスに発行されます。

  `s3Throttled` フィールドは、Amazon S3 からストレージをアップロードまたは取得する際に遅延があったかどうかを示します。値 `true` は遅延があったことを示し、`false` は遅延がなかったことを示します。

  スキャン結果の `s3Throttled` が `true` の場合、Amazon S3 でプレフィックスを設定して各プレフィックスの 1 秒あたりのトランザクション数 (TPS) を削減することをお勧めします。詳細については、「*Amazon S3 ユーザーガイド*」の「[設計パターンのベストプラクティス: Amazon S3 のパフォーマンスの最適化](https://docs.aws.amazon.com/AmazonS3/latest/userguide/optimizing-performance.html)」を参照してください。

  S3 オブジェクトスキャンの結果に対して Amazon EventBridge (EventBridge) ルールを設定する方法については、「[S3 オブジェクトスキャンの結果](#s3-object-scan-status-malware-protection-s3-ev)」を参照してください。
+ **スキャン後のタグ付け失敗イベント**がある場合、次の理由が考えられます。
  + IAM ロールに、オブジェクトにタグ付けするアクセス許可がありません。

    [IAM ポリシーのアクセス許可の追加](malware-protection-s3-iam-policy-prerequisite.md#attach-iam-policy-s3-malware-protection)テンプレートには、GuardDuty がオブジェクトにタグ付けするためのアクセス許可が含まれています。
  + IAM ロールに指定されているバケットリソースまたはオブジェクトが存在しなくなりました。
  + 関連付けられた S3 オブジェクトは、既にタグの最大制限に達しています。タグの制限の詳細については、「*Amazon S3 ユーザーガイド*」の「[タグを使用したストレージの分類](https://docs.aws.amazon.com/AmazonS3/latest/userguide/object-tagging.html)」を参照してください。

  スキャン後のタグ付け失敗イベントに対して Amazon EventBridge (EventBridge) ルールを設定する方法については、「[スキャン後のタグ付け失敗イベント](#post-tag-failure-malware-protection-s3-ev)」を参照してください。

## EventBridge ルールの設定
<a name="set-up-malware-protection-s3-eventbridge-rules"></a>

リソースステータス、スキャン後のタグ付け失敗イベント、または S3 オブジェクトスキャンの結果を別の AWS のサービスに送信するように、アカウントに EventBridge ルールを設定できます。ステータスに変化があると、委任 GuardDuty 管理者アカウントに Malware Protection プランのリソースステータス通知が返されます。

EventBridge の標準料金が適用されます。詳細については、「[Amazon EventBridge の料金](https://aws.amazon.com/eventbridge/pricing/)」を参照してください。

*赤色*で示された値はいずれも、この例のためのプレースホルダーです。これらの値は、アカウントの値と、マルウェアが検出されたかどうかに基づいて変化します。

**Topics**
+ [Malware Protection プランのリソースステータス](#resource-status-malware-protection-s3-ev)
+ [S3 オブジェクトスキャンの結果](#s3-object-scan-status-malware-protection-s3-ev)
+ [スキャン後のタグ付け失敗イベント](#post-tag-failure-malware-protection-s3-ev)

### Malware Protection プランのリソースステータス
<a name="resource-status-malware-protection-s3-ev"></a>

次のシナリオに基づいて EventBridge イベントパターンを作成できます。

**考えられる `detail-type` 値**
+ `"GuardDuty Malware Protection Resource Status Active"`
+ `"GuardDuty Malware Protection Resource Status Warning"`
+ `"GuardDuty Malware Protection Resource Status Error"`

**イベントパターン**

```
{
      "detail-type": ["potential detail-type"],
      "source": ["aws.guardduty"]
}
```

**`GuardDuty Malware Protection Resource Status Active` の通知スキーマの例**:

```
{
    "version": "0",
    "id": "6a7e8feb-b491-4cf7-a9f1-bf3703467718",
    "detail-type": "GuardDuty Malware Protection Resource Status Active",
    "source": "aws.guardduty",
    "account": "111122223333",
    "time": "2017-12-22T18:43:48Z",
    "region": "us-east-1",
    "resources": ["arn:aws:guardduty:us-east-1:111122223333:malware-protection-plan/b4c7f464ab3a4EXAMPLE"],
    "detail": {
        "schemaVersion": "1.0",
        "eventTime": "2024-02-28T01:01:01Z",
        "s3BucketDetails": {
            "bucketName": "amzn-s3-demo-bucket"
        },
        "resourceStatus": "ACTIVE"
    }
}
```

**`GuardDuty Malware Protection Resource Status Warning` の通知スキーマの例**:

```
{
    "version": "0",
    "id": "6a7e8feb-b491-4cf7-a9f1-bf3703467718",
    "detail-type": "GuardDuty Malware Protection Resource Status warning",
    "source": "aws.guardduty",
    "account": "111122223333",
    "time": "2017-12-22T18:43:48Z",
    "region": "us-east-1",
    "resources": ["arn:aws:guardduty:us-east-1:111122223333:malware-protection-plan/b4c7f464ab3a4EXAMPLE"],
    "detail": {
        "schemaVersion": "1.0",
        "eventTime": "2024-02-28T01:01:01Z",
        "s3BucketDetails": {
            "bucketName": "amzn-s3-demo-bucket"
        },
        "resourceStatus": "WARNING",
        "statusReasons": [
         {
            "code": "INSUFFICIENT_TEST_OBJECT_PERMISSIONS"
         }
        ]
    }
}
```

**`GuardDuty Malware Protection Resource Status Error` の通知スキーマの例**:

```
{
    "version": "0",
    "id": "fc7a35b7-83bd-3c1f-ecfa-1b8de9e7f7d2",
    "detail-type": "GuardDuty Malware Protection Resource Status Error",
    "source": "aws.guardduty",
    "account": "111122223333",
    "time": "2017-12-22T18:43:48Z",
    "region": "us-east-1",
    "resources": ["arn:aws:guardduty:us-east-1:111122223333:malware-protection-plan/b4c7f464ab3a4EXAMPLE"],
    "detail": {
        "schemaVersion": "1.0",
        "eventTime": "2024-02-28T01:01:01Z",
        "s3BucketDetails": {
            "bucketName": "amzn-s3-demo-bucket"
        },
        "resourceStatus": "ERROR",
        "statusReasons": [
        {
            "code": "EVENTBRIDGE_MANAGED_EVENTS_DELIVERY_DISABLED"
        }
       ]
    }
}
```

`resourceStatus` `ERROR` の背後にある理由に基づいて、`statusReasons` の値が入力されます。

次の警告とエラーのトラブルシューティング手順については、「[Malware Protection プランのステータスのトラブルシューティング](troubleshoot-s3-malware-protection-status-errors.md)」を参照してください。

### S3 オブジェクトスキャンの結果
<a name="s3-object-scan-status-malware-protection-s3-ev"></a>

```
{
  "detail-type": ["GuardDuty Malware Protection Object Scan Result"],
  "source": ["aws.guardduty"]
}
```

**`NO_THREATS_FOUND` の通知スキーマの例**:

```
{
    "version": "0",
    "id": "72c7d362-737a-6dce-fc78-9e27a0171419",
    "detail-type": "GuardDuty Malware Protection Object Scan Result",
    "source": "aws.guardduty",
    "account": "111122223333",
    "time": "2024-02-28T01:01:01Z",
    "region": "us-east-1",
    "resources": ["arn:aws:guardduty:us-east-1:111122223333:malware-protection-plan/b4c7f464ab3a4EXAMPLE"],
    "detail": {
        "schemaVersion": "1.0",
        "scanStatus": "COMPLETED",
        "resourceType": "S3_OBJECT",
        "s3ObjectDetails": {
            "bucketName": "amzn-s3-demo-bucket",
            "objectKey": "APKAEIBAERJR2EXAMPLE",
            "eTag": "ASIAI44QH8DHBEXAMPLE",
            "versionId" : "d41d8cd98f00b204e9800998eEXAMPLE",
            "s3Throttled": false
        },
        "scanResultDetails": {
            "scanResultStatus": "NO_THREATS_FOUND",
            "threats": null
        }
    }
}
```

**`THREATS_FOUND` の通知スキーマの例**:

```
{
    "version": "0",
    "id": "72c7d362-737a-6dce-fc78-9e27a0171419",
    "detail-type": "GuardDuty Malware Protection Object Scan Result",
    "source": "aws.guardduty",
    "account": "111122223333",
    "time": "2024-02-28T01:01:01Z",
    "region": "us-east-1",
    "resources": ["arn:aws:guardduty:us-east-1:111122223333:malware-protection-plan/b4c7f464ab3a4EXAMPLE"],
    "detail": {
        "schemaVersion": "1.0",
        "scanStatus": "COMPLETED",
        "resourceType": "S3_OBJECT",
        "s3ObjectDetails": {
            "bucketName": "amzn-s3-demo-bucket",
            "objectKey": "APKAEIBAERJR2EXAMPLE",
            "eTag": "ASIAI44QH8DHBEXAMPLE",
            "versionId" : "d41d8cd98f00b204e9800998eEXAMPLE",
            "s3Throttled": false
        },
        "scanResultDetails": {
            "scanResultStatus": "THREATS_FOUND",
            "threats": [
                {
                    "name": "EICAR-Test-File (not a virus)"
                }
            ]
        }
    }
}
```

**注記**  
`scanResultDetails.Threats` フィールドには、脅威が 1 つのみ含まれています。Malware Protection for S3 スキャンでは、デフォルトでは最初に検出された脅威が報告されます。この後、`scanStatus` は `COMPLETED` に設定されます。

**スキャン結果ステータス `UNSUPPORTED` の通知スキーマの例 (スキップ)**:

```
{
    "version": "0",
    "id": "72c7d362-737a-6dce-fc78-9e27a0EXAMPLE",
    "detail-type": "GuardDuty Malware Protection Object Scan Result",
    "source": "aws.guardduty",
    "account": "111122223333",
    "time": "2024-02-28T01:01:01Z",
    "region": "us-east-1",
    "resources": ["arn:aws:guardduty:us-east-1:111122223333:malware-protection-plan/b4c7f464ab3a4EXAMPLE"],
    "detail": {
        "schemaVersion": "1.0",
        "scanStatus": "SKIPPED",
        "resourceType": "S3_OBJECT",
        "s3ObjectDetails": {
            "bucketName": "amzn-s3-demo-bucket",
            "objectKey": "APKAEIBAERJR2EXAMPLE",
            "eTag": "ASIAI44QH8DHBEXAMPLE",
            "versionId" : "d41d8cd98f00b204e9800998eEXAMPLE",
            "s3Throttled": false
        },
        "scanResultDetails": {
            "scanResultStatus": "UNSUPPORTED",
            "threats": null
        }
    }
}
```

**スキャン結果ステータス `ACCESS_DENIED` の通知スキーマの例 (スキップ)**:

```
{
    "version": "0",
    "id": "72c7d362-737a-6dce-fc78-9e27a0EXAMPLE",
    "detail-type": "GuardDuty Malware Protection Object Scan Result",
    "source": "aws.guardduty",
    "account": "111122223333",
    "time": "2024-02-28T01:01:01Z",
    "region": "us-east-1",
    "resources": ["arn:aws:guardduty:us-east-1:111122223333:malware-protection-plan/b4c7f464ab3a4EXAMPLE"],
    "detail": {
        "schemaVersion": "1.0",
        "scanStatus": "SKIPPED",
        "resourceType": "S3_OBJECT",
        "s3ObjectDetails": {
            "bucketName": "amzn-s3-demo-bucket",
            "objectKey": "APKAEIBAERJR2EXAMPLE",
            "eTag": "ASIAI44QH8DHBEXAMPLE",
            "versionId" : "d41d8cd98f00b204e9800998eEXAMPLE",
            "s3Throttled": false
        },
        "scanResultDetails": {
            "scanResultStatus": "ACCESS_DENIED",
            "threats": null
        }
    }
}
```

**スキャン結果ステータス `FAILED` の通知スキーマの例**:

```
{
    "version": "0",
    "id": "72c7d362-737a-6dce-fc78-9e27a0EXAMPLE",
    "detail-type": "GuardDuty Malware Protection Object Scan Result",
    "source": "aws.guardduty",
    "account": "111122223333",
    "time": "2024-02-28T01:01:01Z",
    "region": "us-east-1",
    "resources": ["arn:aws:guardduty:us-east-1:111122223333:malware-protection-plan/b4c7f464ab3a4EXAMPLE"],
    "detail": {
        "schemaVersion": "1.0",
        "scanStatus": "FAILED",
        "resourceType": "S3_OBJECT",
        "s3ObjectDetails": {
            "bucketName": "amzn-s3-demo-bucket",
            "objectKey": "APKAEIBAERJR2EXAMPLE",
            "eTag": "ASIAI44QH8DHBEXAMPLE",
            "versionId" : "d41d8cd98f00b204e9800998eEXAMPLE",
            "s3Throttled": false
        },
        "scanResultDetails": {
            "scanResultStatus": "FAILED",
            "threats": null
        }
    }
}
```

### スキャン後のタグ付け失敗イベント
<a name="post-tag-failure-malware-protection-s3-ev"></a>

**イベントパターン**:

```
{
      "detail-type": "GuardDuty Malware Protection Post Scan Action Failed",
      "source": "aws.guardduty"
 }
```

**`ACCESS_DENIED` の通知スキーマの例**:

```
{
    "version": "0",
    "id": "746acd83-d75c-5b84-91d2-dad5f13ba0d7",
    "detail-type": "GuardDuty Malware Protection Post Scan Action Failed",
    "source": "aws.guardduty",
    "account": "111122223333",
    "time": "2024-06-10T16:16:08Z",
    "region": "us-east-1",
    "resources": ["arn:aws:guardduty:us-east-1:111122223333:malware-protection-plan/b4c7f464ab3a4EXAMPLE"],
    "detail": {
        "schemaVersion": "1.0",
        "eventTime": "2024-06-10T16:16:08Z",
        "s3ObjectDetails": {
            "bucketName": "amzn-s3-demo-bucket",
            "objectKey": "2024-03-10-16-16-00-7D723DE8DBE9Y2E0",
            "eTag": "0e9eeec810ad8b61d69112c15c2a5hb6",
            "versionId" : "d41d8cd98f00b204e9800998eEXAMPLE",
            "s3Throttled": false
        },
        "postScanActions": [{
            "actionType": "TAGGING",
            "failureReason": "ACCESS_DENIED"
        }]
    }
}
```

**`MAX_TAG_LIMIT_EXCEEDED` の通知スキーマの例**:

```
{
    "version": "0",
    "id": "746acd83-d75c-5b84-91d2-dad5f13ba0d7",
    "detail-type": "GuardDuty Malware Protection Post Scan Action Failed",
    "source": "aws.guardduty",
    "account": "111122223333",
    "time": "2024-06-10T16:16:08Z",
    "region": "us-east-1",
    "resources": ["arn:aws:guardduty:us-east-1:111122223333:malware-protection-plan/b4c7f464ab3a4EXAMPLE"],
    "detail": {
        "schemaVersion": "1.0",
        "eventTime": "2024-06-10T16:16:08Z",
        "s3ObjectDetails": {
            "bucketName": "amzn-s3-demo-bucket",
            "objectKey": "2024-03-10-16-16-00-7D723DE8DBE9Y2E0",
            "eTag": "0e9eeec810ad8b61d69112c15c2a5hb6",
            "versionId" : "d41d8cd98f00b204e9800998eEXAMPLE",
            "s3Throttled": false
        },
        "postScanActions": [{
            "actionType": "TAGGING",
            "failureReason": "MAX_TAG_LIMIT_EXCEEDED"
        }]
    }
}
```

こうした失敗理由をトラブルシューティングするには、「[S3 オブジェクトスキャン後のタグ失敗のトラブルシューティング](troubleshoot-s3-post-scan-tag-failures.md)」を参照してください。