

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

# 고객 관리형 키(CMK)를 사용하여 에이전트 세션 암호화
<a name="ltm-permissions"></a>

에이전트에 메모리를 활성화하고 고객 관리형 키로 에이전트 세션을 암호화하는 경우, 고객 관리형 키를 구성하려면 다음 키 정책과 직접 호출 ID IAM 권한을 구성해야 합니다.

**고객 관리형 키 정책**

Amazon Bedrock은 이러한 권한을 사용하여 암호화된 데이터 키를 생성한 다음, 생성된 키를 사용하여 에이전트 메모리를 암호화합니다. Amazon Bedrock에는 생성된 데이터 키를 다른 암호화 컨텍스트로 다시 암호화할 수 있는 권한도 필요합니다. 재암호화 권한은 고객 관리형 키가 다른 고객 관리형 키 또는 서비스 소유 키 간에 전환될 때도 사용됩니다. 자세한 내용은 [Hierarchical Keyring](https://docs.aws.amazon.com//database-encryption-sdk/latest/devguide/use-hierarchical-keyring.html)을 참조하세요.

`$region`, `account-id`, `${caller-identity-role}`을 적절한 값으로 변경합니다.

```
{
    "Version": "2012-10-17",		 	 	 
    {
        "Sid": "Allow access for bedrock to enable long term memory",
        "Effect": "Allow",
        "Principal": {
            "Service": [
                "bedrock.amazonaws.com",
            ],
        },
        "Action": [
            "kms:GenerateDataKeyWithoutPlainText",
            "kms:ReEncrypt*"
        ],
        "Condition": {
            "StringEquals": {
                "aws:SourceAccount": "$account-id"
            },
            "ArnLike": {
                "aws:SourceArn": "arn:aws:bedrock:$region:$account-id:agent-alias/*"
            }
        }
        "Resource": "*"
    },
    {
        "Sid": "Allow the caller identity control plane permissions for long term memory",
        "Effect": "Allow", 
        "Principal": {
            "AWS": "arn:aws:iam::${account-id}:role/${caller-identity-role}"
        },
        "Action": [
            "kms:GenerateDataKeyWithoutPlainText",
            "kms:ReEncrypt*"
        ],
        "Resource": "*",
        "Condition": {
            "StringLike": {
                "kms:EncryptionContext:aws-crypto-ec:aws:bedrock:arn": "arn:aws:bedrock:${region}:${account-id}:agent-alias/*"
            }
        }
    },
    {
        "Sid": "Allow the caller identity data plane permissions to decrypt long term memory",
        "Effect": "Allow",
        "Principal": {
            "AWS": "arn:aws:iam::${account-id}:role/${caller-identity-role}"
        },
        "Action": [
            "kms:Decrypt"
        ],
        "Resource": "*",
        "Condition": {
            "StringLike": {
                "kms:EncryptionContext:aws-crypto-ec:aws:bedrock:arn": "arn:aws:bedrock:${region}:${account-id}:agent-alias/*",
                "kms:ViaService": "bedrock.$region.amazonaws.com" 
            }
        }
    }
}
```

**에이전트 메모리를 암호화하고 복호화할 수 있는 IAM 권한**

ID 직접 호출 에이전트 API가 메모리가 활성화된 에이전트에 대한 KMS 키를 구성하려면 다음 IAM 권한이 필요합니다. Amazon Bedrock 에이전트는 이러한 권한을 사용하여 호출자 ID가 위의 API 키 정책에 언급된 권한으로 모델을 관리, 훈련, 배포할 수 있는지 확인합니다. 에이전트를 간접적으로 호출하는 API의 경우 Amazon Bedrock 에이전트는 호출자 ID의 `kms:Decrypt` 권한을 사용하여 메모리를 복호화합니다.

`$region`, `account-id`, `${key-id}`을 적절한 값으로 변경합니다.

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

****  

```
{
    "Version":"2012-10-17",		 	 	 
    "Statement": [
        {
            "Sid": "AgentsControlPlaneLongTermMemory",
            "Effect": "Allow",
            "Action": [
                "kms:GenerateDataKeyWithoutPlaintext", 
                "kms:ReEncrypt*"
            ],
            "Resource": "arn:aws:kms:us-east-1:123456789012:key/KeyId",
            "Condition": {
                "StringLike": {
                    "kms:EncryptionContext:aws-crypto-ec:aws:bedrock:arn": "arn:aws:bedrock:us-east-1:123456789012:agent-alias/*"
                }
            }
        },
        {
            "Sid": "AgentsDataPlaneLongTermMemory",
            "Effect": "Allow",
            "Action": [
                "kms:Decrypt"
            ],
            "Resource": "arn:aws:kms:us-east-1:123456789012:key/KeyId",
            "Condition": {
                "StringLike": {
                    "kms:EncryptionContext:aws-crypto-ec:aws:bedrock:arn": "arn:aws:bedrock:us-east-1:123456789012:agent-alias/*"
                }
            }
        }
    ]
}
```

------