

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

# Amazon SNS 데이터 보호 정책 예제
<a name="sns-message-data-protection-examples"></a>

**중요**  
신규 고객은 Amazon SNS 메시지 데이터 보호를 더 이상 사용할 수 없습니다. 대안에 대한 자세한 내용과 지침은 [Amazon SNS 메시지 데이터 보호 가용성 변경을](https://docs.aws.amazon.com/sns/latest/dg/sns-message-data-protection-availability-change.html) 참조하세요.

다음 예는 중요한 데이터를 감사 및 거부하는 데 사용할 수 있는 데이터 보호 정책입니다. 예시 애플리케이션이 포함된 전체 자습서는 [Amazon SNS에 대한 메시지 데이터 보호 소개](https://aws.amazon.com/blogs/compute/introducing-message-data-protection-for-amazon-sns/) 블로그 게시물을 참조하세요.

## 감사 정책 예시
<a name="sns-message-data-protection-audit-example"></a>

감사 정책을 사용하면 인바운드 메시지의 최대 99%를 감사하고 조사 결과를 [Amazon CloudWatch](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/WhatIsCloudWatch.html), [https://docs.aws.amazon.com/firehose/latest/dev/what-is-this-service.html](https://docs.aws.amazon.com/firehose/latest/dev/what-is-this-service.html) 및 [Amazon S3](https://docs.aws.amazon.com/AmazonS3/latest/userguide/Welcome.html)로 보낼 수 있습니다.

예를 들어 감사 정책을 만들어 시스템에서 중요한 데이터를 실수로 보내거나 받는지 여부를 평가할 수 있습니다. 감사 결과 시스템에서 신용 카드 정보가 필요하지 않은 시스템에 신용 카드 정보를 보내는 것으로 나타나면 데이터 보호 정책을 구현하여 데이터 전달을 차단할 수 있습니다.

다음 예제에서는 신용카드 번호를 찾고 조사 결과를 CloudWatch Logs, Firehose, Amazon S3로 전송하여 주제를 통해 전달되는 메시지의 99%를 감사합니다.

**데이터 보호 정책**:

```
{
  "Name": "__example_data_protection_policy",
  "Description": "Example data protection policy",
  "Version": "2021-06-01",
  "Statement": [
    {
      "DataDirection": "Inbound",
      "Principal": ["*"],
      "DataIdentifier": [
        "arn:aws:dataprotection::aws:data-identifier/CreditCardNumber"
      ],
      "Operation": {
        "Audit": {
          "SampleRate": "99",
          "FindingsDestination": {
            "CloudWatchLogs": {
              "LogGroup": "<example log name>"
            },
            "Firehose": {
              "DeliveryStream": "<example stream name>"
            },
            "S3": {
              "Bucket": "<example bucket name>"
            }
          }
        }
      }
    }
  ]
}
```

**감사 결과 형식 예시**:

```
{
    "messageId": "...",
    "callerPrincipal": "arn:aws:sts::123456789012:assumed-role/ExampleRole",
    "resourceArn": "arn:aws:sns:us-east-1:123456789012:ExampleArn", 
    "dataIdentifiers": [
        {
            "name": "CreditCardNumber",
            "count": 1,
            "detections": [
                { "start": 1, "end": 2 }
            ]
        }
    ],
    "timestamp": "2021-04-20T00:33:40.241Z"
}
```

## 인바운드 비식별 마스킹 문이 포함된 정책 예시
<a name="sns-message-data-protection-inbound-deidentify-mask-example"></a>

다음 예에서는 메시지 콘텐츠에서 민감한 데이터를 마스킹하여 사용자가 `CreditCardNumber`가 포함된 메시지를 주제에 게시하지 못하도록 차단합니다.

```
{
  "Name": "__example_data_protection_policy",
  "Description": "Example data protection policy",
  "Version": "2021-06-01",
  "Statement": [
    {
      "DataDirection": "Inbound",
      "Principal": [
        "arn:aws:iam::123456789012:user/ExampleUser"
      ],
      "DataIdentifier": [
        "arn:aws:dataprotection::aws:data-identifier/CreditCardNumber"
      ],
      "Operation": {
        "Deidentify": {
          "MaskConfig": {
            "MaskWithCharacter": "#"
          }
        }
      }
    }
  ]
}
```

**인바운드 비식별 마스킹 결과 예시:**

```
// original message
My credit card number is 4539894458086459

// delivered message
My credit card number is ################
```

## 인바운드 비식별 수정 문이 포함된 정책 예시
<a name="sns-message-data-protection-inbound-deidentify-redact-example"></a>

다음 예에서는 메시지 콘텐츠에서 민감한 데이터를 수정하여 사용자가 `CreditCardNumber`가 포함된 메시지를 주제에 게시하지 못하도록 차단합니다.

```
{
  "Name": "__example_data_protection_policy",
  "Description": "Example data protection policy",
  "Version": "2021-06-01",
  "Statement": [
    {
      "DataDirection": "Inbound",
      "Principal": [
        "arn:aws:iam::123456789012:user/ExampleUser"
      ],
      "DataIdentifier": [
        "arn:aws:dataprotection::aws:data-identifier/CreditCardNumber"
      ],
      "Operation": {
        "Deidentify": {
          "RedactConfig": {}
        }
      }
    }
  ]
}
```

**인바운드 비식별 수정 결과 예시:**

```
// original message
My credit card number is 4539894458086459

// delivered message
My credit card number is
```

## 아웃바운드 비식별 마스킹 문이 포함된 정책 예시
<a name="sns-message-data-protection-outbound-deidentify-mask-example"></a>

다음 예에서는 메시지 콘텐츠에서 민감한 데이터를 마스킹하여 사용자가 `CreditCardNumber`가 포함된 메시지를 수신하지 않도록 차단합니다.

```
{
  "Name": "__example_data_protection_policy",
  "Description": "Example data protection policy",
  "Version": "2021-06-01",
  "Statement": [
    {
      "DataDirection": "Outbound",
      "Principal": [
        "arn:aws:iam::123456789012:user/ExampleUser"
      ],
      "DataIdentifier": [
        "arn:aws:dataprotection::aws:data-identifier/CreditCardNumber"
      ],
      "Operation": {
        "Deidentify": {
          "MaskConfig": {
            "MaskWithCharacter": "-"
          }
        }
      }
    }
  ]
}
```

**아웃바운드 비식별 마스킹 결과 예시:**

```
// original message
My credit card number is 4539894458086459

// delivered message
My credit card number is ----------------
```

## 아웃바운드 비식별 수정 문이 포함된 정책 예시
<a name="sns-message-data-protection-outbound-deidentify-redact-example"></a>

다음 예에서는 메시지 콘텐츠에서 민감한 데이터를 수정하여 사용자가 `CreditCardNumber`가 포함된 메시지를 수신하지 않도록 차단합니다.

```
{
  "Name": "__example_data_protection_policy",
  "Description": "Example data protection policy",
  "Version": "2021-06-01",
  "Statement": [
    {
      "DataDirection": "Outbound",
      "Principal": [
        "arn:aws:iam::123456789012:user/ExampleUser"
      ],
      "DataIdentifier": [
        "arn:aws:dataprotection::aws:data-identifier/CreditCardNumber"
      ],
      "Operation": {
        "Deidentify": {
          "RedactConfig": {}
        }
      }
    }
  ]
}
```

**아웃바운드 비식별 수정 결과 예시:**

```
// original message
My credit card number is 4539894458086459

// delivered message
My credit card number is
```

## 정책 인바운드 거부 명령문 예시
<a name="sns-message-data-protection-inbound-deny-example"></a>

다음 예에서는 사용자가 메시지 콘텐츠에 `CreditCardNumber`가 있는 주제에 메시지를 게시하지 못하도록 차단합니다. API 응답에서 거부된 페이로드의 상태 코드는 "403 AuthorizationError"입니다.

```
{
  "Name": "__example_data_protection_policy",
  "Description": "Example data protection policy",
  "Version": "2021-06-01",
  "Statement": [
    {
      "DataDirection": "Inbound",
      "Principal": [
        "arn:aws:iam::123456789012:user/ExampleUser"
      ],
      "DataIdentifier": [
        "arn:aws:dataprotection::aws:data-identifier/CreditCardNumber"
      ],
      "Operation": {
        "Deny": {}
      }
    }
  ]
}
```

## 정책 아웃바운드 거부 명령문 예시
<a name="sns-message-data-protection-outbound-deny-example"></a>

다음 예시에서는 AWS 계정이가 포함된 메시지를 수신하지 못하도록 차단합니다`CreditCardNumber`.

```
{
  "Name": "__example_data_protection_policy",
  "Description": "Example data protection policy",
  "Version": "2021-06-01",
  "Statement": [
    {
      "DataDirection": "Outbound",
      "Principal": [
        "arn:aws:iam::123456789012:user/ExampleUser"
      ],
      "DataIdentifier": [
        "arn:aws:dataprotection::aws:data-identifier/CreditCardNumber"
      ],
      "Operation": {
        "Deny": {}
      }
    }
  ]
}
```

**아웃바운드 거부 결과 예시, Amazon CloudWatch CloudWatch에 로그인:**

```
{
  "notification": {
    "messageMD5Sum": "2e8f58ff2eeed723b56b15493fbfb5a5",
    "messageId": "8747a956-ebf1-59da-b291-f2c2e4b87c9c",
    "topicArn": "arn:aws:sns:us-east-2:664555388960:test1",
    "timestamp": "2022-09-08 15:40:57.144"
  },
  "delivery": {
    "deliveryId": "6a422437-78cc-5171-ad64-7fa3778507aa",
    "destination": "arn:aws:sqs:us-east-2:664555388960:test",
    "providerResponse": "The topic's data protection policy prohibits this message from being delivered to <subscription arn>",
    "dwellTimeMs": 22,
    "attempts": 1,
    "statusCode": 403
  },
  "status": "FAILURE"
}
```