

기계 번역으로 제공되는 번역입니다. 제공된 번역과 원본 영어의 내용이 상충하는 경우에는 영어 버전이 우선합니다.

# 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/)를 참조하세요.

GuardDuty는 S3용 멀웨어 방지으로 보호되는 S3 버킷의 소유자 계정으로서 다음 시나리오에서 기본 이벤트 버스에 EventBridge 알림을 게시합니다.
+ **맬웨어 방지 계획 리소스 상태**가 보호된 버킷에 대해 변경됩니다. 다양한 상태에 대한 자세한 내용은 [보호된 버킷 상태 보기 및 이해](malware-protection-s3-bucket-status-gdu.md)를 참조하세요.

  리소스 상태에 대한 Amazon EventBridge(EventBridge) 규칙 설정은 [맬웨어 보호 계획 리소스 상태](#resource-status-malware-protection-s3-ev)을 참조하세요.
+ **S3 객체 스캔 결과**가 기본 EventBridge 이벤트 버스에 게시됩니다.

  `s3Throttled` 필드는 Amazon S3에서 스토리지를 업로드하거나 검색하는 데 지연이 있었는지 여부를 나타냅니다. `true` 값은 지연이 있었음을 나타내고 `false`는 지연이 없음을 나타냅니다.

  `s3Throttled`가 스캔 결과 `true`에 대한 경우 Amazon S3는 각 접두사에 대한 초당 트랜잭션(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>

계정에서 EventBridge 규칙을 설정하여 리소스 상태, 스캔 후 태그 실패 이벤트 또는 S3 객체 스캔 결과를 다른 AWS 서비스로 전송할 수 있습니다. 위임된 GuardDuty 관리자 계정으로서 상태 변경이 있을 때 멀웨어 방지 플랜 리소스 상태 알림을 받게 됩니다.

표준 EventBridge 요금이 적용됩니다. 자세한 내용은 [Amazon EventBridge 요금](https://aws.amazon.com/eventbridge/pricing/)을 참조하세요.

{{빨간색}}으로 표시되는 모든 값은 예제의 자리 표시자입니다. 이 값은 계정의 값과 멀웨어 탐지 여부에 따라 변경됩니다.

**Topics**
+ [맬웨어 보호 계획 리소스 상태](#resource-status-malware-protection-s3-ev)
+ [S3 객체 스캔 결과](#s3-object-scan-status-malware-protection-s3-ev)
+ [스캔 후 태그 실패 이벤트](#post-tag-failure-malware-protection-s3-ev)

### 맬웨어 보호 계획 리소스 상태
<a name="resource-status-malware-protection-s3-ev"></a>

다음 시나리오에 따라 이벤트 브리지 이벤트 패턴을 만들 수 있습니다.

**잠재적 `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` 값이 채워집니다.

다음 경고 및 오류에 대한 문제 해결 단계에 대한 자세한 내용은 [맬웨어 방지 계획 상태 문제 해결](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"]
}
```

`scanStatus`가 인 경우 `SKIPPED`에는 스캔을 건너뛴 구체적인 이유를 제공하는 `statusReasons` 필드가 `scanResultDetails` 포함됩니다. 가능한 값에 대한 자세한 내용은 섹션을 참조하세요[S3 객체 전위 스캔 상태 및 결과 상태](monitoring-malware-protection-s3-scans-gdu.md#s3-object-scan-result-value-malware-protection).

**`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,
            "statusReasons": 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)}}"
                }
            ],
            "statusReasons": null
        }
    }
}
```

**참고**  
`scanResultDetails.Threats` 필드에는 하나의 위협만 포함됩니다. 기본적으로 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,
            "statusReasons": ["{{PASSWORD_PROTECTED}}"]
        }
    }
}
```

**스캔 결과 상태 `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,
            "statusReasons": ["{{SSE_C_ENCRYPTED_OBJECT}}"]
        }
    }
}
```

**스캔 결과 상태 `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,
            "statusReasons": 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)을 참조하세요.