

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

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

**중요**  
Amazon SNS 메시지 데이터 보호는 2026년 4월 30일부터 신규 고객에게 더 이상 제공되지 않습니다. 대안에 대한 자세한 내용과 지침은 [Amazon SNS 메시지 데이터 보호 가용성 변경을](https://docs.aws.amazon.com/sns/latest/dg/sns-message-data-protection-availability-change.html) 참조하세요.

## 데이터 보호 정책이란 무엇입니까?
<a name="what-are-data-protection-policies"></a>

Amazon SNS는 **데이터 보호 정책**을 사용하여 검색하려는 중요한 데이터와 해당 데이터가 Amazon SNS 주제에 의해 교환되지 않도록 보호하기 위해 취하려는 작업을 선택합니다. 관심 있는 중요한 데이터를 선택하려면 [데이터 식별자](sns-message-data-protection-managed-data-identifiers.md)를 사용합니다. 그런 다음 Amazon SNS 메시지 데이터 보호는 기계 학습 및 패턴 일치를 사용하여 중요한 데이터를 탐지합니다. 발견된 데이터 식별자에 따라 조치를 취하기 위해 **감사**, **비식별** 또는 **거부** 작업을 정의할 수 있습니다. 이러한 작업을 통해 발견된(또는 찾을 수 없는) 중요한 데이터를 기록하거나 마스킹, 수정 또는 메시지 배달을 거부할 수 있습니다.

![\[Amazon SNS는 데이터 보호 정책을 활용하여 여러에서 민감한 데이터를 관리하고 보호합니다 AWS 서비스. 또한 인바운드 및 아웃바운드 메시지 모두에 대한 워크플로를 보여주며, 개인 식별 정보(PII) 및 보호 대상 상태 정보(PHI)와 같은 정보를 보호하기 위해 데이터 전송을 감사, 비식별화, 거부하는 등의 정책 설정을 기반으로 데이터를 모니터링하고 조치를 취하는 방법을 자세히 설명합니다.\]](http://docs.aws.amazon.com/ko_kr/sns/latest/dg/images/message-data-protection-policies-overview.png)


## 데이터 보호 정책은 어떻게 구성되어 있습니까?
<a name="overview-of-data-protection-policies"></a>

다음 그림처럼 데이터 보호 정책 문서는 다음 요소를 포함합니다.
+ 문서 상단에 위치하는 정책 전반의 선택적 정보
+ 하나 이상의 개별 문

각 설명문에는 단일 권한에 대한 정보가 포함되어 있습니다.

![\[Amazon SNS의 데이터 보호 정책의 구조가 나와 있으며, 정책 이름, 설명, 버전 및 데이터 방향, 식별자, 관련 위탁자를 기반으로 감사, 비식별화, 거부와 같은 작업을 지정하는 여러 스테이트먼트와 같은 다양한 요소로 정책이 구성되는 방식을 보여줍니다.\]](http://docs.aws.amazon.com/ko_kr/sns/latest/dg/images/payload-policy-process.png)


Amazon SNS 주제당 하나의 데이터 보호 정책만 정의할 수 있습니다. 데이터 보호 정책은 하나 이상의 거부 또는 비식별 명령문과 하나의 감사 명령문을 가질 수 있습니다.

### 데이터 보호 정책의 JSON 속성
<a name="data-protection-policy-json-properties"></a>

데이터 보호 정책에는 식별을 위해 다음과 같은 기본 정책 정보가 필요합니다.
+ **Name**(이름) – 정책 이름입니다.
+ **Description**(설명)(선택 사항) – 정책 설명입니다.
+ **Version**(버전) - 정책 언어 버전입니다. 현재 버전은 2021-06-01입니다.
+ **Statement**(명령문) - 데이터 보호 정책 조치를 지정하는 명령문 목록입니다.

```
{
  "Name": "basicPII-protection",
  "Description": "Protect basic types of sensitive data",
  "Version": "2021-06-01",
  "Statement": [
        ...
  ]
}
```

### 정책 명령문을 위한 JSON 속성
<a name="policy-statement-json-properties"></a>

정책 명령문은 데이터 보호 작업에 대한 탐지 컨텍스트를 설정합니다.
+ **Sid**(선택 사항) - 명령문 식별자입니다.
+ **DataDirection** - Amazon SNS 주제에 대한 인바운드(Publish API 요청의 경우) 또는 아웃바운드(알림 전달의 경우)입니다.
+ **DataIdentifier** – Amazon SNS 주제가 검색해야 하는 중요한 데이터입니다. 이러한 데이터로는 이름, 주소 또는 전화번호가 있습니다.
+ **Principal** - 주제에 게시한 IAM 보안 주체 또는 해당 주제를 구독한 IAM 보안 주체입니다.
+ **Operation**(작업) - Amazon SNS 주제가 중요한 데이터를 찾으면 실행하는 후속 작업인 **감사**, **비식별**(마스킹 또는 수정) 또는 **거부**(차단)입니다. 

```
{
    "Sid": "basicPII-inbound-protection",
    "DataDirection": "Inbound",
    "Principal": ["*"],
    "DataIdentifier": [
        "arn:aws:dataprotection::aws:data-identifier/Name",
        "arn:aws:dataprotection::aws:data-identifier/PhoneNumber-US"
    ],
    "Operation": {
        ...
    }
}
```

### 정책 명령문 작업을 위한 JSON 속성
<a name="statement-operation-json-properties"></a>

정책 명령문은 다음 데이터 보호 작업 중 하나를 설정합니다.
+ [**감사**](sns-message-data-protection-operations.md#statement-operation-json-properties-audit) – 메시지 게시 또는 배달을 중단하지 않고 메트릭을 내보내고 로그를 찾습니다.
+ [**De-identify**](sns-message-data-protection-operations.md#statement-operation-json-properties-deidentify)(비식별) - 메시지 게시를 중단하지 않고 민감한 데이터를 마스킹하거나 수정합니다.
+ [**거부**](sns-message-data-protection-operations.md#statement-operation-json-properties-deny) - Amazon SNS 게시 요청을 차단하거나 메시지 전송에 실패합니다.

## 내 데이터 보호 정책에 대한 IAM 보안 주체를 결정하려면 어떻게 해야 합니까?
<a name="data-protection-policy-iam-principal-determined"></a>

메시지 데이터 보호는 Amazon SNS와 상호 작용하는 두 개의 IAM 보안 주체를 사용합니다.

1. **Publish API 보안 주체**(인바운드) – Amazon SNS `Publish` API를 호출하는 인증된 IAM 보안 주체입니다.

1. **구독 보안 주체**(아웃바운드) – 구독 생성 중에 `Subscribe` API를 호출한 인증된 보안 주체입니다.

`SubscriptionPrincipal`은 `GetSubscriptionAttributes` API에서 검색할 수 있는 공개적으로 사용 가능한 Amazon SNS 구독 속성입니다.

```
{
  "Attributes": {
    "SubscriptionPrincipal": "arn:aws:iam::123456789012:user/NoNameAccess",
    "Owner": "123412341234",
    "RawMessageDelivery": "true",
    "TopicArn": "arn:aws:sns:us-east-1:123412341234:PII-data-topic",
    "Endpoint": "arn:aws:sqs:us-east-1:123456789012:NoNameAccess",
    "Protocol": "sqs",
    "PendingConfirmation": "false",
    "ConfirmationWasAuthenticated": "true",
    "SubscriptionArn": "arn:aws:sns:us-east-1:123412341234:PII-data-topic:5d8634ef-67ef-49eb-a824-4042b28d6f55"
  }
}
```

# Amazon SNS의 데이터 보호 정책 작업
<a name="sns-message-data-protection-operations"></a>

**중요**  
Amazon SNS 메시지 데이터 보호는 2026년 4월 30일부터 신규 고객에게 더 이상 제공되지 않습니다. 대안에 대한 자세한 내용과 지침은 [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="statement-operation-json-properties-audit"></a>

**감사** 작업은 주제 인바운드 메시지를 샘플링하고 민감한 데이터 조사 결과를 AWS 대상에 기록합니다. 샘플 레이트는 0\$199 사이의 정수일 수 있습니다. 이 작업에는 다음 유형의 로깅 대상 중 하나가 필요합니다.

1. **FindingsDestination** – Amazon SNS 주제가 페이로드에서 중요한 데이터를 찾은 경우의 로깅 대상입니다.

1. **NoFindingsDestination** – Amazon SNS 주제가 페이로드에서 중요한 데이터를 찾지 못한 경우의 로깅 대상입니다.

다음 각 로그 대상 유형 AWS 서비스 에서 다음을 사용할 수 있습니다.
+ **Amazon CloudWatch Logs**(선택 사항) – `LogGroup`은 주제 지역에 있어야 하고 이름은 **/aws/vendedlogs/**로 시작해야 합니다.
+ ** **(선택 사항) – `DeliveryStream`은 주제 리전에 있어야 하며 전송 스트림의 소스로 **Direct PUT**을 보유해야 합니다. 자세한 내용은 *Amazon Data Firehose 개발자 안내서*의 [소스, 대상 및 이름](https://docs.aws.amazon.com/firehose/latest/dev/create-name.html)을 참조하세요.
+ **Amazon S3**(선택 사항) - Amazon S3 버킷 이름입니다. [SSE-KMS 암호화가 활성화된 Amazon S3 버킷을 사용하려면 추가 작업이 필요합니다](#flow-logs-s3-cmk-policy).

```
{
  "Operation": {
    "Audit": {
      "SampleRate": "99",
      "FindingsDestination": {
            "CloudWatchLogs": {
                "LogGroup": "/aws/vendedlogs/log-group-name"
            },
            "Firehose": {
                "DeliveryStream": "delivery-stream-name"
            },
            "S3": {
                "Bucket": "bucket-name"
            }
      },
      "NoFindingsDestination": {
            "CloudWatchLogs": {
                "LogGroup": "/aws/vendedlogs/log-group-name"
            },
            "Firehose": {
                "DeliveryStream": "delivery-stream-name"
            },
            "S3": {
                "Bucket": "bucket-name"
            }
      }
    }
  }
}
```

### 로그 대상 지정 시 필요한 권한
<a name="required-permissions-log-operations"></a>

데이터 보호 정책에서 로깅 대상을 지정할 때 Amazon SNS `PutDataProtectionPolicy` API 또는 `--data-protection-policy` 파라미터가 있는 `CreateTopic` API를 호출하는 IAM 보안 주체의 IAM 자격 증명 정책에 다음 권한을 추가해야 합니다.


| 감사 대상 | IAM 권한 | 
| --- | --- | 
| 기본값 | logs:CreateLogDelivery logs:GetLogDelivery logs:UpdateLogDelivery logs:DeleteLogDelivery logs:ListLogDeliveries  | 
| CloudWatchLogs | logs:PutResourcePolicy logs:DescribeResourcePolicies logs:DescribeLogGroups  | 
| Firehose | iam:CreateServiceLinkedRole firehose:TagDeliveryStream  | 
| S3 | s3:PutBucketPolicy s3:GetBucketPolicy [SSE-KMS 암호화가 활성화된 Amazon S3 버킷을 사용하려면 추가 작업이 필요합니다](#flow-logs-s3-cmk-policy).  | 

------
#### [ JSON ]

****  

```
{
    "Version":"2012-10-17",		 	 	 
    "Statement": [
        {
            "Effect": "Allow",
            "Action": [
                "logs:CreateLogDelivery",
                "logs:GetLogDelivery",
                "logs:UpdateLogDelivery",
                "logs:DeleteLogDelivery",
                "logs:ListLogDeliveries"
            ],
            "Resource": [
                "*"
            ]
        },
        {
            "Effect": "Allow",
            "Action": [
                "logs:PutResourcePolicy",
                "logs:DescribeResourcePolicies",
                "logs:DescribeLogGroups"
            ],
            "Resource": [
                "arn:aws:logs:us-west-1:123456789012:SampleLogGroupName:*:*"
            ]
        },
        {
            "Effect": "Allow",
            "Action": [
                "iam:CreateServiceLinkedRole",
                "firehose:TagDeliveryStream"
            ],
            "Resource": "*"
        },
        {
            "Effect": "Allow",
            "Action": [
                "s3:PutBucketPolicy",
                "s3:GetBucketPolicy"
            ],
            "Resource": [
                "arn:aws:s3:::bucket-name"
            ]
        }
    ]
}
```

------

#### SSE-KMS를 사용할 경우 필요한 키 정책
<a name="flow-logs-s3-cmk-policy"></a>

Amazon S3 버킷을 로그 대상으로 사용하는 경우 Amazon S3-Managed 키를 사용한 서버 측 암호화(SSE-S3) 또는 AWS KMS keys (SSE-KMS)를 사용한 서버 측 암호화를 활성화하여 버킷의 데이터를 보호할 수 있습니다. 자세한 내용은 *Amazon S3 사용 설명서*의 [서버 측 암호화를 사용하여 데이터 보호](https://docs.aws.amazon.com/AmazonS3/latest/userguide/serv-side-encryption.html)를 참조하세요.

SSE-S3를 선택하면 추가 구성이 필요하지 않습니다. Amazon S3는 암호화 키를 처리합니다.

SSE-KMS를 선택하면 고객 관리형 키를 사용해야 합니다. 로그 전달 계정이 S3 버킷에 쓸 수 있도록 고객 관리형 키에 대한 키 정책을 업데이트해야 합니다. SSE-KMS와 함께 사용하는 데 필요한 키 정책에 대한 자세한 내용은 *Amazon CloudWatch Logs 사용 설명서*의 [Amazon S3 버킷 서버 측 암호화](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/AWS-logs-and-resource-policy.html#AWS-logs-SSE-KMS-S3)를 참조하세요.

### 감사 대상 로그 예시
<a name="data-protection-policy-audit-destination-log"></a>

다음 예에서는 `callerPrincipal`을 사용하여 민감한 콘텐츠의 소스를 식별하고 `messageID`를 참조로 사용하여 `Publish` API 응답을 확인합니다.

```
{
  "messageId": "34d9b400-c6dd-5444-820d-fbeb0f1f54cf",
  "auditTimestamp": "2022-05-12T2:10:44Z",
  "callerPrincipal": "arn:aws:iam::123412341234:role/Publisher",
  "resourceArn": "arn:aws:sns:us-east-1:123412341234:PII-data-topic",
  "dataIdentifiers": [
    {
      "name": "Name",
      "count": 1,
      "detections": [
        {
          "start": 1,
          "end": 2
        }
      ]
    },
    {
      "name": "PhoneNumber",
      "count": 2,
      "detections": [
        {
          "start": 3,
          "end": 4
        },
        {
          "start": 5,
          "end": 6
        }
      ]
    }
  ]
}
```

### 감사 작업 지표
<a name="data-protection-policy-audit-metrics"></a>

감사 작업이 `FindingsDestination` 또는 `NoFindingsDestination` 속성을 지정한 경우 주제 소유자는 CloudWatch `MessagesWithFindings` 및 `MessagesWithNoFindings` 지표도 수신합니다.

![\[지정된 기간 동안 데이터를 표시하는 감사 예시.\]](http://docs.aws.amazon.com/ko_kr/sns/latest/dg/images/audit-operations-metrics.png)


## 비식별 작업
<a name="statement-operation-json-properties-deidentify"></a>

**비식별화** 작업은 게시되거나 배달된 메시지에서 민감한 데이터를 마스킹하거나 수정합니다. 이 작업은 인바운드 메시지와 아웃바운드 메시지에 모두 사용할 수 있으며 다음 유형의 구성 중 하나가 필요합니다.
+ **MaskConfig** - 다음 표의 지원되는 문자를 사용하여 마스킹합니다. 예를 들어, ssn: `123-45-6789`는 ssn: `###########`이 됩니다.

  ```
  {
  "Operation": {
      "Deidentify": {
          "MaskConfig": {
              "MaskWithCharacter": "#"
            }
      }
  }
  ```    
[\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/ko_kr/sns/latest/dg/sns-message-data-protection-operations.html)
+ **RedactConfig** - 데이터를 완전히 제거하여 수정합니다. 예를 들어, ssn: `123-45-6789`는 ssn: ` `이 됩니다.

  ```
  {
  "Operation": {
      "Deidentify": {
          "RedactConfig": {}
      }
  }
  ```

인바운드 메시지에서 중요한 데이터는 감사 작업 후 익명화되며, 전체 메시지가 중요한 경우 `SNS:Publish` API 호출자는 다음과 같은 잘못된 매개변수 오류를 수신합니다.

`Error code: AuthorizationError ...`

## 거부 작업
<a name="statement-operation-json-properties-deny"></a>

**Deny**(거부) 작업은 `Publish` API 요청 또는 메시지에 중요한 데이터가 포함된 경우 메시지 배달을 중단합니다. Deny(거부) 작업 개체는 추가 구성이 필요하지 않으므로 비어 있습니다.

```
"Operation": {
    "Deny": {}
}
```

인바운드 메시지에서 `SNS:Publish` API 호출자는 권한 부여 오류를 수신합니다.

`Error code: AuthorizationError ...`

아웃바운드 메시지에서 Amazon SNS 주제는 구독에 메시지를 전달하지 않습니다. 승인되지 않은 배달을 추적하려면 주제의 [전송 상태 로깅](sns-topic-attributes.md)을 사용하도록 설정하세요. 다음은 전송 상태 로그의 예입니다.

```
{
    "notification": {
        "messageMD5Sum": "29638742ffb68b32cf56f42a79bcf16b",
        "messageId": "34d9b400-c6dd-5444-820d-fbeb0f1f54cf",
        "topicArn": "arn:aws:sns:us-east-1:123412341234:PII-data-topic",
        "timestamp": "2022-05-12T2:12:44Z"
    },
    "delivery": {
        "deliveryId": "98236591c-56aa-51ee-a5ed-0c7d43493170",
        "destination": "arn:aws:sqs:us-east-1:123456789012:NoNameAccess",
        "providerResponse": "The topic's data protection policy prohibits this message from being delivered to <subscription-arn>",
        "dwellTimeMs":20,
        "attempts":1,
        "statusCode": 403
    },
    "status": "FAILURE"
}
```

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

**중요**  
Amazon SNS 메시지 데이터 보호는 2026년 4월 30일부터 신규 고객에게 더 이상 제공되지 않습니다. 대안에 대한 자세한 내용과 지침은 [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"
}
```

# Amazon SNS의 데이터 보호 정책 생성
<a name="sns-message-data-protection-configure"></a>

**중요**  
Amazon SNS 메시지 데이터 보호는 2026년 4월 30일부터 신규 고객에게 더 이상 제공되지 않습니다. 대안에 대한 자세한 내용과 지침은 [Amazon SNS 메시지 데이터 보호 가용성 변경을](https://docs.aws.amazon.com/sns/latest/dg/sns-message-data-protection-availability-change.html) 참조하세요.

[데이터 보호 정책](sns-message-data-protection-policies.md)은 애플리케이션 또는 AWS 서비스간에 이동하는 중요한 정보를 감사, 비식별(마스킹 또는 수정), 거부(차단)하여 Amazon SNS 주제에 게시된 데이터를 보호하는 데 도움이 됩니다. AWS API AWS CLI, CloudFormation또는 AWS Management Console 를 사용하여 Amazon SNS에서 데이터 보호 정책을 생성할 수 있습니다. Amazon SNS 주제당 하나만 정의할 수 있습니다. 각 데이터 보호 정책은 하나 이상의 비식별 및 거부 명령문을 가질 수 있지만, 하나의 감사 명령문을 가질 수 있습니다.

**Topics**
+ [API 사용](sns-message-data-protection-configure-api.md)
+ [사용 AWS CLI](sns-message-data-protection-configure-cli.md)
+ [CloudFormation 사용](sns-message-data-protection-configure-cfn.md)
+ [사용 AWS Management Console](sns-message-data-protection-configure-console.md)
+ [AWS SDK 사용](sns-message-data-protection-configure-sdk.md)

# API를 사용하여 Amazon SNS의 데이터 보호 정책 생성
<a name="sns-message-data-protection-configure-api"></a>

**중요**  
Amazon SNS 메시지 데이터 보호는 2026년 4월 30일부터 신규 고객에게 더 이상 제공되지 않습니다. 대안에 대한 자세한 내용과 지침은 [Amazon SNS 메시지 데이터 보호 가용성 변경을](https://docs.aws.amazon.com/sns/latest/dg/sns-message-data-protection-availability-change.html) 참조하세요.

 AWS 계정의 Amazon SNS 리소스 수와 크기는 제한됩니다. 자세한 내용은 [Amazon Simple Notification Service 엔드포인트 및 할당량](https://docs.aws.amazon.com/general/latest/gr/sns.html)을 참조하세요.

## API를 사용하여 데이터 보호 정책 만들기
<a name="create-policies-api"></a>

 AWS API를 사용하여 Amazon SNS 데이터 보호 정책을 생성합니다.

**Amazon SNS 주제와 함께 데이터 보호 정책을 생성하려면(AWS API)**  
표준 Amazon SNS 주제의 `DataProtectionPolicy` 속성을 사용합니다.
+ [https://docs.aws.amazon.com/sns/latest/api/API_CreateTopic.html](https://docs.aws.amazon.com/sns/latest/api/API_CreateTopic.html)

**기존 Amazon SNS 주제에 대한 데이터 보호 정책을 검색하거나 생성하려면(AWS API)**  
다음 작업 중 하나를 호출합니다.
+ [GetDataProtectionPolicy](https://docs.aws.amazon.com/sns/latest/api/API_GetDataProtectionPolicy.html)
+ [PutDataProtectionPolicy](https://docs.aws.amazon.com/sns/latest/api/API_PutDataProtectionPolicy.html)

# CLI를 사용하여 Amazon SNS의 데이터 보호 정책 생성
<a name="sns-message-data-protection-configure-cli"></a>

**중요**  
Amazon SNS 메시지 데이터 보호는 2026년 4월 30일부터 신규 고객에게 더 이상 제공되지 않습니다. 대안에 대한 자세한 내용과 지침은 [Amazon SNS 메시지 데이터 보호 가용성 변경을](https://docs.aws.amazon.com/sns/latest/dg/sns-message-data-protection-availability-change.html) 참조하세요.

 AWS 계정의 Amazon SNS 리소스 수와 크기는 제한됩니다. 자세한 내용은 [Amazon Simple Notification Service 엔드포인트 및 할당량](https://docs.aws.amazon.com/general/latest/gr/sns.html)을 참조하세요.

## 를 사용하여 데이터 보호 정책 생성 AWS CLI
<a name="create-policies-cli"></a>

 AWS Command Line Interface를 사용하여 Amazon SNS 데이터 보호 정책을 생성합니다.

**Amazon SNS 주제와 함께 데이터 보호 정책 생성(AWS CLI)**  
이 옵션을 사용하여 표준 Amazon SNS 주제와 함께 새 데이터 보호 정책을 생성합니다.
+ [create-topic](https://docs.aws.amazon.com/cli/latest/reference/sns/create-topic.html)

**기존 Amazon SNS 주제에 대한 데이터 보호 정책을 생성 또는 검색(AWS CLI)**  
다음 작업 중 하나를 호출합니다.
+ [get-data-protection-policy](https://docs.aws.amazon.com/cli/latest/reference/sns/get-data-protection-policy.html)
+ [put-data-protection-policy](https://docs.aws.amazon.com/cli/latest/reference/sns/put-data-protection-policy.html)

# CloudFormation을 사용하여 Amazon SNS의 데이터 보호 정책 만들기
<a name="sns-message-data-protection-configure-cfn"></a>

**중요**  
Amazon SNS 메시지 데이터 보호는 2026년 4월 30일부터 신규 고객에게 더 이상 제공되지 않습니다. 대안에 대한 자세한 내용과 지침은 [Amazon SNS 메시지 데이터 보호 가용성 변경을](https://docs.aws.amazon.com/sns/latest/dg/sns-message-data-protection-availability-change.html) 참조하세요.

 AWS 계정의 Amazon SNS 리소스 수와 크기는 제한됩니다. 자세한 내용은 [Amazon Simple Notification Service 엔드포인트 및 할당량](https://docs.aws.amazon.com/general/latest/gr/sns.html)을 참조하세요.

## 데이터 보호 정책 생성(CloudFormation)
<a name="create-policies-cfn"></a>

를 사용하여 Amazon SNS 데이터 보호 정책을 생성합니다 CloudFormation.

**Amazon SNS 주제와 함께 데이터 보호 정책 생성(CloudFormation)**  
이 옵션을 사용하여 표준 Amazon SNS 주제와 함께 새 데이터 보호 정책을 생성합니다.
+ [AWS::SNS::Topic](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-sns-topic.html)

# 콘솔을 사용하여 Amazon SNS의 데이터 보안 정책 생성
<a name="sns-message-data-protection-configure-console"></a>

**중요**  
Amazon SNS 메시지 데이터 보호는 2026년 4월 30일부터 신규 고객에게 더 이상 제공되지 않습니다. 대안에 대한 자세한 내용과 지침은 [Amazon SNS 메시지 데이터 보호 가용성 변경을](https://docs.aws.amazon.com/sns/latest/dg/sns-message-data-protection-availability-change.html) 참조하세요.

 AWS 계정의 Amazon SNS 리소스 수와 크기는 제한됩니다. 자세한 내용은 [Amazon Simple Notification Service 엔드포인트 및 할당량](https://docs.aws.amazon.com/general/latest/gr/sns.html)을 참조하세요.

**Amazon SNS 주제와 함께 데이터 보호 정책 생성(콘솔)**  
표준 Amazon SNS 주제와 함께 새 데이터 보호 정책을 생성하려면 이 옵션을 사용합니다.

1. [Amazon SNS 콘솔](https://console.aws.amazon.com/sns/home)에 로그인합니다.

1. 주제를 선택하거나 새로운 주제를 생성합니다. 주제 생성에 대한 자세한 내용은 [Amazon SNS 주제 생성](sns-create-topic.md)을 참조하세요.

1. **Create topic**(주제 생성) 페이지의 **Details**(세부 정보) 섹션에서 **Standard**(표준)를 선택합니다.

   1. 주제의 **이름**을 입력합니다.

   1. (선택 사항) 주제의 **표시 이름**을 입력합니다.

1. **Data protection policy**(데이터 보호 정책)를 확장합니다.

1. 다음 **Configuration mode**(구성 모드)를 선택합니다.
   + **Basic**(기본) - 간단한 메뉴를 사용하여 데이터 보호 정책을 정의합니다.
   + **Advanced**(고급) - JSON을 사용하여 사용자 지정 데이터 보호 정책을 정의합니다.

1. (선택 사항) 자체 **사용자 지정 데이터 식별자**를 생성하려면 **사용자 지정 데이터 식별자 구성 섹션**을 확장하고 다음을 수행합니다.

   1. 사용자 지정 데이터 식별자에 고유한 **이름**을 입력합니다. 사용자 지정 데이터 식별자는 영숫자, 밑줄(\$1) 및 하이픈(-) 문자를 지원합니다. 최대 128자까지 지원됩니다. 이 이름은 [관리형 데이터 식별자](sns-message-data-protection-managed-data-identifiers.md)와 동일한 이름을 공유할 수 없습니다. 사용자 지정 데이터 식별자 제한의 전체 목록은 [사용자 지정 데이터 식별자 제약](sns-message-data-protection-custom-data-identifiers.md#custom-data-identifiers-limitations) 섹션을 참조하세요.

   1. 사용자 지정 데이터 식별자에 대한 정규 표현식(RegEx)을 입력합니다. RegEx는 영숫자, RegEx 예약 문자 및 기호를 지원합니다. RegEx의 최대 길이는 200자입니다. RegEx가 너무 복잡하면 Amazon SNS에서 API 호출이 실패합니다. RegeX 제한의 전체 목록은 [사용자 지정 데이터 식별자 제약](sns-message-data-protection-custom-data-identifiers.md#custom-data-identifiers-limitations) 섹션을 참조하세요.

   1. (선택 사항) **사용자 지정 데이터 식별자 추가**를 선택하여 필요에 따라 데이터 식별자를 더 추가합니다. 각 데이터 보호 정책에 최대 10개의 사용자 지정 데이터 식별자가 지원됩니다.

1. 데이터 보호 정책에 추가하려는 명령문을 선택합니다. **감사**, **비식별**(마스킹 또는 수정) 및 **거부**(차단) 명령문 유형을 동일한 데이터 보호 정책에 추가할 수 있습니다.

   1. **Add audit statement**(감사 명세서 추가) - 감사할 중요한 데이터, 해당 데이터에 대해 감사할 메시지 비율, 감사 로그를 보낼 위치를 구성합니다.
**참고**  
데이터 보호 정책 또는 주제당 하나의 감사 명령문만 허용됩니다.

      1. 감사하려는 중요한 데이터를 정의하려면 **데이터 식별자**를 선택합니다.

      1. **Audit sample rate**(감사 샘플 비율)에서는 중요한 정보를 감사할 메시지의 백분율을 최대 99%까지 입력합니다.

      1. **감사 대상**에서 감사 결과 결과를 전송할 대상 AWS 서비스 을 선택하고 AWS 서비스 사용하는 각의 대상 이름을 입력합니다. 다음 Amazon Web Services 중에서 선택할 수 있습니다.
         + **Amazon CloudWatch** - CloudWatch Logs는 AWS 표준 로깅 솔루션입니다. CloudWatch Logs를 사용하면 Logs Insights를 사용하여([여기에서 샘플 참조](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/CWL_QuerySyntax-examples.html)) 로그 분석을 수행하고 지표 및 경보를 생성할 수 있습니다. CloudWatch Logs는 많은 서비스가 로그를 게시하는 곳이므로 하나의 솔루션을 사용하여 모든 로그를 더 쉽게 집계할 수 있습니다. Amazon CloudWatch에 대한 내용은 [Amazon CloudWatch 사용 설명서](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/WhatIsCloudWatch.html)를 참조하세요.
         + **** – Firehose는 추가 로그 분석을 위해 Splunk, OpenSearch 및 Amazon Redshift에 대한 실시간 스트리밍 요구 사항을 충족합니다. 자세한 내용은 [사용 설명서](https://docs.aws.amazon.com/firehose/latest/dev/what-is-this-service.html)를 참조하세요.
         + **Amazon Simple Storage Service** - Amazon S3는 보관을 위한 경제적인 로그 대상입니다. 몇 년 동안 로그를 보관해야 할 수도 있습니다. 이 경우 Amazon S3에 로그를 입력하여 비용을 절약할 수 있습니다. Amazon Simple Storage Service에 대한 자세한 내용은 [Amazon Simple Storage Service 사용 설명서](https://docs.aws.amazon.com/AmazonS3/latest/userguide/Welcome.html)를 참조하세요.

   1. **Add a de-identify statement**(비식별 명령문 추가) - 메시지에서 비식별할 민감한 데이터, 해당 데이터를 마스킹 또는 수정할지 여부, 해당 데이터의 전송을 중지할 계정을 구성합니다.

      1. **데이터 식별자**에서는 비식별하려는 민감한 데이터를 선택합니다.

      1. **이 비식별화 문 정의**에서이 비식별화 문이 적용되는 AWS 계정 또는 IAM 보안 주체를 선택합니다. **모든 AWS 계정** 또는 계정 ID 또는 IAM 엔터티 ARN을 사용하는 **특정 AWS 계정** 또는 **IAM 엔터티**(계정 루트, 역할 또는 사용자)에 적용할 수 있습니다. 여러 ID 또는 ARN을 쉼표(,)를 사용하여 구분합니다.

         지원되는 [IAM 보안 주체](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_identifiers.html)는 다음과 같습니다.
         + **IAM account principals**(IAM 계정 보안 주체) - 예: `arn:aws:iam::AWS-account-ID:root`.
         + **IAM role principals**(IAM 역할 주체) - 예:`arn:aws:iam::AWS-account-ID:role/role-name`.
         + **IAM user principals**(IAM 사용자 주체) - 예:`arn:aws:iam::AWS-account-ID:user/user-name`.

      1. **De-identify Option**(비식별 옵션)에서는 민감한 데이터를 비식별할 방법을 선택합니다. 지원되는 옵션은 다음과 같습니다.
         + **Redact**(수정) - 데이터를 완전히 제거합니다. 예를 들어 이메일: `classified@amazon.com`은 이메일: ` `이 됩니다.
         + **Mask**(마스크) - 데이터를 단일 문자로 바꿉니다. 예를 들어 이메일: `classified@amazon.com`은 이메일: `*********************`이 됩니다.

      1. (선택 사항)필요에 따라 비식별 명령문을 계속 추가합니다.

   1. **Add deny statement**(거부 명령문 추가) – 주제를 통해 이동하는 것을 방지할 중요한 데이터와 해당 데이터 전달을 방지할 보안 주체를 구성합니다.

      1. **data direction**(데이터 방향)에서는 거부 명령문의 메시지 방향을 선택합니다.
         + **Inbound messages**(인바운드 메시지) - 이 거부 설명을 주제로 전송된 메시지에 적용합니다.
         + **Outbound messages**(아웃바운드 메시지) - 이 거부 설명을 해당 주제가 구독 엔드포인트에 전달하는 메시지에 적용합니다.

      1. 거부하려는 중요한 데이터를 정의하려면 **data identifiers**(데이터 식별자)를 선택합니다.

      1. 이 거부 명령문이 적용되는 **IAM principals**(IAM 보안 주체)를 선택합니다. 계정 ID 또는 **IAM 엔**터티 ARN을 사용하는 **모든 AWS 계정**, **특정 AWS 계정** 또는 IAM 엔터티(예: 계정 루트, 역할 또는 사용자)에 적용할 수 있습니다. IDs ARNs 여러 ID 또는 ARN을 쉼표(,)를 사용하여 구분합니다. 지원되는 [IAM 보안 주체](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_identifiers.html)는 다음과 같습니다.
         + **IAM account principals**(IAM 계정 보안 주체) - 예: `arn:aws:iam::AWS-account-ID:root`.
         + **IAM 역할 주체** - 예:`arn:aws:iam::AWS-account-ID:role/role-name`.
         + **IAM 사용자 주체** - 예:`arn:aws:iam::AWS-account-ID:user/user-name`.

      1. (선택 사항) 필요에 따라 거부 명령문을 계속 추가합니다.

# SDK를 사용하여 메시지 데이터를 보호하기 위한 Amazon SNS 데이터 보안 정책 생성
<a name="sns-message-data-protection-configure-sdk"></a>

**중요**  
Amazon SNS 메시지 데이터 보호는 2026년 4월 30일부터 신규 고객에게 더 이상 제공되지 않습니다. 대안에 대한 자세한 내용과 지침은 [Amazon SNS 메시지 데이터 보호 가용성 변경을](https://docs.aws.amazon.com/sns/latest/dg/sns-message-data-protection-availability-change.html) 참조하세요.

 AWS 계정의 Amazon SNS 리소스 수와 크기는 제한됩니다. 자세한 내용은 [Amazon Simple Notification Service 엔드포인트 및 할당량](https://docs.aws.amazon.com/general/latest/gr/sns.html)을 참조하세요.

## AWS SDK를 사용하여 데이터 보호 정책 생성
<a name="create-policies-sdk"></a>

 AWS SDK를 사용하여 Amazon SNS 데이터 보호 정책을 생성합니다.

**Amazon SNS 주제(AWS SDK)와 함께 데이터 보호 정책을 생성하려면**  
다음 옵션을 사용하여 표준 Amazon SNS 주제와 함께 새 데이터 보호 정책을 생성합니다.

------
#### [ Java ]

```
/**
 * For information regarding CreateTopic see this documentation topic:
 *
 * https://docs.aws.amazon.com/code-samples/latest/catalog/javav2-sns-src-main-java-com-example-sns-CreateTopic.java.html
 */

public static String createSNSTopicWithDataProtectionPolicy(SnsClient snsClient, String topicName, String dataProtectionPolicy) {

    try {
        CreateTopicRequest request = CreateTopicRequest.builder()
                .name(topicName)
                .dataProtectionPolicy(dataProtectionPolicy)
                .build();

        CreateTopicResponse result = snsClient.createTopic(request);
        return result.topicArn();
    } catch (SnsException e) {
        System.err.println(e.awsErrorDetails().errorMessage());
        System.exit(1);
    }
    return "";
}
```

------
#### [ JavaScript ]

```
// Import required AWS SDK clients and commands for Node.js
import {CreateTopicCommand } from "@aws-sdk/client-sns";
import {snsClient } from "./libs/snsClient.js";

// Set the parameters
const params = { Name: "TOPIC_NAME", DataProtectionPolicy: "DATA_PROTECTION_POLICY" };

const run = async () => {
  try {
    const data = await snsClient.send(new CreateTopicCommand(params));
    console.log("Success.",  data);
    return data; // For unit tests.
  } catch (err) {
    console.log("Error", err.stack);
  }
};
run();
```

------

**기존 Amazon SNS 주제(AWS SDK)에 대한 데이터 보호 정책을 생성하거나 검색하려면**  
다음 옵션을 사용하여 표준 Amazon SNS 주제와 함께 새 데이터 보호 정책을 생성 또는 검색합니다.

------
#### [ Java ]

```
public static void putDataProtectionPolicy(SnsClient snsClient, String topicName, String dataProtectionPolicy) {

    try {
        PutDataProtectionPolicyRequest request = PutDataProtectionPolicyRequest.builder()
                .resourceArn(topicName)
                .dataProtectionPolicy(dataProtectionPolicy)
                .build();

        PutDataProtectionPolicyResponse result = snsClient.putDataProtectionPolicy(request);
        System.out.println("\n\nStatus was " + result.sdkHttpResponse().statusCode() 
                + "\n\nTopic " + request.resourceArn()
                + " DataProtectionPolicy " + request.dataProtectionPolicy());
    } catch (SnsException e) {
        System.err.println(e.awsErrorDetails().errorMessage());
        System.exit(1);
    }
}


public static void getDataProtectionPolicy(SnsClient snsClient, String topicName) {

    try {
        GetDataProtectionPolicyRequest request = GetDataProtectionPolicyRequest.builder()
                .resourceArn(topicName)
                .build();
        
        GetDataProtectionPolicyResponse result = snsClient.getDataProtectionPolicy(request);
        
        System.out.println("\n\nStatus is " + result.sdkHttpResponse().statusCode() 
        + "\n\nDataProtectionPolicy: \n\n" + result.dataProtectionPolicy());
    } catch (SnsException e) {
        System.err.println(e.awsErrorDetails().errorMessage());
        System.exit(1);
    }
}
```

------
#### [ JavaScript ]

```
// Import required AWS SDK clients and commands for Node.js
import {PutDataProtectionPolicyCommand, GetDataProtectionPolicyCommand } from "@aws-sdk/client-sns";
import {snsClient } from "./libs/snsClient.js";

// Set the parameters
const putParams = { ResourceArn: "TOPIC_ARN", DataProtectionPolicy: "DATA_PROTECTION_POLICY" };

const runPut = async () => {
  try {
    const data = await snsClient.send(new PutDataProtectionPolicyCommand(putParams));
    console.log("Success.",  data);
    return data; // For unit tests.
  } catch (err) {
    console.log("Error", err.stack);
  }
};
runPut();

// Set the parameters
const getParams = { ResourceArn: "TOPIC_ARN" };

const runGet = async () => {
  try {
    const data = await snsClient.send(new GetDataProtectionPolicyCommand(getParams));
    console.log("Success.",  data);
    return data; // For unit tests.
  } catch (err) {
    console.log("Error", err.stack);
  }
};
runGet();
```

------

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

**중요**  
Amazon SNS 메시지 데이터 보호는 2026년 4월 30일부터 신규 고객에게 더 이상 제공되지 않습니다. 대안에 대한 자세한 내용과 지침은 [Amazon SNS 메시지 데이터 보호 가용성 변경을](https://docs.aws.amazon.com/sns/latest/dg/sns-message-data-protection-availability-change.html) 참조하세요.

 AWS API AWS CLI, CloudFormation또는를 사용하여 Amazon SNS 데이터 보호 정책을 **삭제할** 수 있습니다 AWS Management Console.

Amazon SNS 데이터 보호 정책에 대한 일반 정보는 [Amazon SNS 데이터 보호 정책 이해](sns-message-data-protection-policies.md) 섹션을 참조하세요.

 AWS 계정의 Amazon SNS 데이터 보호 정책 리소스의 수와 크기는 제한되어 있습니다. 자세한 내용은 AWS 일반 참조의 [Amazon SNS API 제한](https://docs.aws.amazon.com/general/latest/gr/sns.html)을 참조하세요.

## 콘솔을 사용하여 데이터 보호 정책 삭제
<a name="sns-delete-data-protection-policy"></a>

**콘솔을 사용하여 관리형 데이터 보호 정책을 삭제하는 방법**

1. [Amazon SNS 콘솔](https://console.aws.amazon.com/sns/home)에 로그인합니다.

1. 삭제하려는 데이터 보호 정책이 포함된 주제를 선택합니다.

1. **Edit**(편집)을 선택합니다.

1. **Data protection policy**(데이터 보호 정책) 섹션을 확장합니다.

1. 제거하려는 데이터 보호 정책 명령문 옆에 있는 **Remove**(제거)를 선택합니다.

1. **Save changes**(변경 사항 저장)를 선택합니다.

## 빈 JSON 문자열을 사용하여 데이터 보호 정책 삭제
<a name="sns-message-data-protection-remove-example-json"></a>

데이터 보호 정책을 빈 JSON 문자열로 업데이트하여 삭제할 수 있습니다.

## 를 사용하여 데이터 보호 정책 삭제 AWS CLI
<a name="sns-message-data-protection-remove-example-cli"></a>

 AWS CLI를 사용하여 데이터 보호 정책을 삭제할 수 있습니다.

`//aws sns put-data-protection-policy --resource-arn topic-arn --data-protection-policy ""`