

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# 使用 AWS KMS key 加密指標匯出
<a name="storage_lens_encrypt_permissions"></a>

若要授予 Amazon S3 Storage Lens 使用客戶受管金鑰加密指標匯出的許可，您必須使用金鑰政策。若要更新您的金鑰政策，以使用 KMS 金鑰來加密 S3 Storage Lens 指標匯出，請依照以下步驟執行。

**授予 S3 Storage Lens 使用 KMS 金鑰加密資料的許可**

1.  AWS 管理主控台 使用 AWS 帳戶 擁有客戶受管金鑰的 登入 。

1. 在 https：//[https://console.aws.amazon.com/kms](https://console.aws.amazon.com/kms) 開啟 AWS KMS 主控台。

1. 若要變更 AWS 區域，請使用頁面右上角的區域**選擇器**。

1. 在左側導覽窗格中，選擇 **Customer managed keys (客戶受管金鑰)**。

1. 在**客戶受管金鑰**下，選擇您要用來加密指標匯出的金鑰。 AWS KMS keys 為區域特定，且必須與指標匯出目的地 S3 儲存貯體位於相同的區域。

1. 在 **Key policy (金鑰政策)** 下，選擇 **Switch to policy view (切換至政策檢視)**。

1. 若要更新金鑰政策，請選擇 **Edit (編輯)**。

1. 在 **Edit key policy (編輯金鑰政策)** 下，將下列金鑰政策新增至現有的金鑰政策。若要使用此政策，請以您的資訊取代 ` user input placeholders `。

   ```
   {
       "Sid": "Allow Amazon S3 Storage Lens use of the KMS key",
        "Effect": "Allow",
       "Principal": {
           "Service": "storage-lens.s3.amazonaws.com"
       },
       "Action": [
           "kms:GenerateDataKey"
       ],
       "Resource": "*",
       "Condition": {
          "StringEquals": {
              "aws:SourceArn": "arn:aws:s3:us-east-1:        source-account-id:storage-lens/your-dashboard-name",
              "aws:SourceAccount": "source-account-id"
           }
        }
   }
   ```

1. 選擇**儲存變更**。

如需建立客戶受管金鑰和使用金鑰政策的詳細資訊，請參閱《AWS Key Management Service 開發人員指南》**中的下列主題：
+  [建立 KMS 金鑰](https://docs.aws.amazon.com/kms/latest/developerguide/create-keys.html) 
+  [中的金鑰政策 AWS KMS](https://docs.aws.amazon.com/kms/latest/developerguide/key-policies.html) 

您也可以使用 AWS KMS `PUT`金鑰政策 API 操作 ([https://docs.aws.amazon.com/kms/latest/APIReference/API_PutKeyPolicy.html](https://docs.aws.amazon.com/kms/latest/APIReference/API_PutKeyPolicy.html)) 將金鑰政策複製到您要使用 REST API AWS CLI和 SDKs 加密指標匯出的客戶受管金鑰。