

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

# `AWS-EnableS3BucketKeys`
<a name="automation-aws-enableS3bucketkeys"></a>

 **Description** 

`AWS-EnableS3BucketKeys` Runbook 會在您指定的 Amazon Simple Storage Service (Amazon S3) 儲存貯體上啟用儲存貯體金鑰。此儲存貯體層級金鑰會在其生命週期期間為新物件建立資料金鑰。如果您未指定 `KmsKeyId` 參數的值，則使用 Amazon S3 受管金鑰 (SSE-S3) 的伺服器端加密會用於預設加密組態。

**注意**  
使用 AWS Key Management Service (AWS KMS) 金鑰 (DSSE-KMS) 的雙層伺服器端加密不支援 Amazon S3 儲存貯體金鑰。

 [執行此自動化 （主控台）](https://console.aws.amazon.com/systems-manager/automation/execute/AWS-EnableS3BucketKeys) 

**文件類型**

 自動化

**擁有者**

Amazon

**平台**

Linux、macOS、 Windows

**參數**
+ AutomationAssumeRole

  類型：字串

  描述：（選用） 允許 Systems Manager Automation 代表您執行動作的 (IAM) 角色的 AWS Identity and Access Management Amazon Resource Name (ARN)。如果未指定角色，Systems Manager Automation 會使用啟動此 Runbook 之使用者的許可。
+ BucketName

  類型：字串

  描述：（必要） 您要為其啟用儲存貯體金鑰的 S3 儲存貯體名稱。
+ KMSKeyId

  類型：字串

   描述：（選用） 要用於伺服器端加密之 AWS Key Management Service (AWS KMS) 客戶受管金鑰的 Amazon Resource Name (ARN)、金鑰 ID 或金鑰別名。

**必要的 IAM 許可**

`AutomationAssumeRole` 參數需要下列動作才能成功使用 Runbook。
+ `ssm:StartAutomationExecution`
+ `ssm:GetAutomationExecution`
+ `s3:GetEncryptionConfiguration`
+ `s3:PutEncryptionConfiguration`

 **文件步驟** 
+ ChooseEncryptionType (aws：branch) - 評估為 `KmsKeyId` 參數提供的值，以判斷是否將使用 SSE-S3 (AES256) 或 SSE-KMS。
+ PutBucketKeysKMS (aws：executeAwsApi) - 使用指定的 ，將指定 S3 儲存貯`true`體的 `BucketKeyEnabled` 屬性設定為 `KmsKeyId`。
+ PutBucketKeysAES256 (aws：executeAwsApi) - 使用 AES256 加密將指定 S3 儲存貯`true`體的 `BucketKeyEnabled` 屬性設定為 。
+ VerifyS3BucketKeysEnabled (aws：assertAwsResourceProperty) - 驗證已在目標 S3 儲存貯體上啟用儲存貯體金鑰。