

本文属于机器翻译版本。若本译文内容与英语原文存在差异，则一律以英文原文为准。

# 使用加密输出数据和存储卷 AWS KMS
<a name="sms-security-kms-permissions"></a>

通过在创建标签作业时指定[客户管理的密钥](https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#master_keys)，可以使用 AWS Key Management Service (AWS KMS) 来加密标签作业的输出数据。如果使用 API 操作 `CreateLabelingJob` 创建使用自动数据标注的标注作业，还可以使用客户托管密钥来加密附加到 ML 计算实例的存储卷，以运行训练和推理作业。

本节介绍为启用输出数据加密而必须附加到客户托管密钥的 IAM 策略，以及为使用存储卷加密而必须附加到客户托管密钥和执行角色的策略。要了解有关这些选项的更多信息，请参阅[输出数据和存储卷加密](sms-security.md)。

## 使用 KMS 加密输出数据
<a name="sms-security-kms-permissions-output-data"></a>

如果您指定 AWS KMS 客户托管密钥来加密输出数据，则必须在该密钥中添加类似于以下内容的 IAM 策略。此策略向用于创建标注作业的 IAM 执行角色授予相关权限，以便使用此密钥执行 `"Action"` 中列出的所有操作。要了解有关这些操作的更多信息，请参阅《 AWS Key Management Service 开发者指南》中的[AWS KMS 权限](https://docs.aws.amazon.com/kms/latest/developerguide/kms-api-permissions-reference.html)。

要使用此策略，请将 `"Principal"` 中的 IAM 服务角色 ARN 替换为您用来创建标注作业的执行角色的 ARN。在控制台中创建标注作业时，这是您在**作业概览**部分为 **IAM 角色**指定的角色。当您使用 `CreateLabelingJob` 创建标注作业时，这是您为 [https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_CreateLabelingJob.html#sagemaker-CreateLabelingJob-request-RoleArn](https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_CreateLabelingJob.html#sagemaker-CreateLabelingJob-request-RoleArn) 指定的 ARN。

```
{
    "Sid": "AllowUseOfKmsKey",
    "Effect": "Allow",
    "Principal": {
        "AWS": "arn:aws:iam::111122223333:role/service-role/example-role"
    },
    "Action": [
        "kms:Encrypt",
        "kms:Decrypt",
        "kms:ReEncrypt*",
        "kms:GenerateDataKey*",
        "kms:DescribeKey"
    ],
    "Resource": "*"
}
```

## 加密自动数据标注 ML 计算实例存储卷
<a name="sms-security-kms-permissions-storage-volume"></a>

如果指定 [https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_LabelingJobResourceConfig.html#sagemaker-Type-LabelingJobResourceConfig-VolumeKmsKeyId](https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_LabelingJobResourceConfig.html#sagemaker-Type-LabelingJobResourceConfig-VolumeKmsKeyId) 来加密附加到用于自动数据标注训练和推理的 ML 计算实例的存储卷，则必须执行以下操作：
+ 将[使用 KMS 加密输出数据](#sms-security-kms-permissions-output-data)中所述的权限附加到客户托管密钥。
+ 将类似于以下内容的策略附加到用于创建标注作业的 IAM 执行角色。这是您在 `CreateLabelingJob` 中为 [https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_CreateLabelingJob.html#sagemaker-CreateLabelingJob-request-RoleArn](https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_CreateLabelingJob.html#sagemaker-CreateLabelingJob-request-RoleArn) 指定的 IAM 角色。要详细了解本政策允许的`"kms:CreateGrant"`操作，请参阅 AWS Key Management Service API 参考[https://docs.aws.amazon.com/kms/latest/APIReference/API_CreateGrant.html](https://docs.aws.amazon.com/kms/latest/APIReference/API_CreateGrant.html)中的。

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

****  

```
{
"Version":"2012-10-17",		 	 	  
"Statement": 
 [  
   {
    "Effect": "Allow",
    "Action": [
       "kms:CreateGrant"
    ],
    "Resource": "*"
  }
]
}
```

------

要进一步了解 Ground Truth 存储卷加密，请参阅[使用 KMS 密钥加密自动数据标注存储卷（仅限 API）](sms-security.md#sms-security-kms-storage-volume)。