本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。
預設啟用 Amazon EBS 加密
您可以設定 AWS 帳戶,強制加密您建立的新 EBS 磁碟區和快照複本。例如,當您啟動執行個體和您從未加密快照複製的快照,Amazon EBS 會加密所建立的 EBS 磁碟區。如需從未加密轉移至已加密 EBS 資源的範例,請參閱 加密未加密的資源。
預設加密不會影響現有的 EBS 磁碟區或快照。
考量事項
- Amazon EC2 console
-
對區域啟用預設加密
在 https://console.aws.amazon.com/ec2/
開啟 Amazon EC2 主控台。 -
從導覽列中選取 Region (區域)。
-
從導覽窗格,選取 EC2 Dashboard (EC2 儀表板)。
-
在頁面右上角選擇 帳戶屬性及資料保護和安全性。
-
在 EBS 加密區段中,選擇管理。
-
選取 Enable (啟用)。您可以將 AWS 受管金鑰 以代您
aws/ebs
建立的別名保留為預設加密金鑰,或選擇對稱客戶受管加密金鑰。 -
選擇 Update EBS encryption (更新 EBS 加密)。
- AWS CLI
-
依預設設定檢視加密
-
對於特定區域
$
aws ec2 get-ebs-encryption-by-default --regionregion
-
對於您帳戶中的所有區域
$
echo -e "Region \t Encrypt \t Key"; \ echo -e "----------- \t ------- \t -------" ; \ for region in $(aws ec2 describe-regions --region us-east-1 --query "Regions[*].[RegionName]" --output text); do default=$(aws ec2 get-ebs-encryption-by-default --region $region --query "{Encryption_By_Default:EbsEncryptionByDefault}" --output text); kms_key=$(aws ec2 get-ebs-default-kms-key-id --region $region | jq '.KmsKeyId'); echo -e "$region \t $default \t\t $kms_key"; done
依預設啟用加密
-
對於特定區域
$
aws ec2 enable-ebs-encryption-by-default --regionregion
-
對於您帳戶中的所有區域
$
echo -e "Region \t Encrypt \t Key"; \ echo -e "----------- \t ------- \t -------" ; \ for region in $(aws ec2 describe-regions --region us-east-1 --query "Regions[*].[RegionName]" --output text); do default=$(aws ec2 enable-ebs-encryption-by-default --region $region --query "{Encryption_By_Default:EbsEncryptionByDefault}" --output text); kms_key=$(aws ec2 get-ebs-default-kms-key-id --region $region | jq '.KmsKeyId'); echo -e "$region \t $default \t\t $kms_key"; done
依預設停用加密
-
對於特定區域
$
aws ec2 disable-ebs-encryption-by-default --regionregion
-
對於您帳戶中的所有區域
$
echo -e "Region \t Encrypt \t Key"; \ echo -e "----------- \t ------- \t -------" ; \ for region in $(aws ec2 describe-regions --region us-east-1 --query "Regions[*].[RegionName]" --output text); do default=$(aws ec2 disable-ebs-encryption-by-default --region $region --query "{Encryption_By_Default:EbsEncryptionByDefault}" --output text); kms_key=$(aws ec2 get-ebs-default-kms-key-id --region $region | jq '.KmsKeyId'); echo -e "$region \t $default \t\t $kms_key"; done
-
- PowerShell
-
依預設設定檢視加密
-
對於特定區域
PS C:\>
Get-EC2EbsEncryptionByDefault -Regionregion
-
對於您帳戶中的所有區域
PS C:\>
(Get-EC2Region).RegionName |` ForEach-Object { [PSCustomObject]@{ Region = $_; EC2EbsEncryptionByDefault = Get-EC2EbsEncryptionByDefault -Region $_; EC2EbsDefaultKmsKeyId = Get-EC2EbsDefaultKmsKeyId -Region $_ } } |` Format-Table -AutoSize
依預設啟用加密
-
對於特定區域
PS C:\>
Enable-EC2EbsEncryptionByDefault -Regionregion
-
對於您帳戶中的所有區域
PS C:\>
(Get-EC2Region).RegionName |` ForEach-Object { [PSCustomObject]@{ Region = $_; EC2EbsEncryptionByDefault = Enable-EC2EbsEncryptionByDefault -Region $_; EC2EbsDefaultKmsKeyId = Get-EC2EbsDefaultKmsKeyId -Region $_ } } | ` Format-Table -AutoSize
依預設停用加密
-
對於特定區域
PS C:\>
Disable-EC2EbsEncryptionByDefault -Regionregion
-
對於您帳戶中的所有區域
PS C:\>
(Get-EC2Region).RegionName |` ForEach-Object { [PSCustomObject]@{ Region = $_; EC2EbsEncryptionByDefault = Disable-EC2EbsEncryptionByDefault -Region $_; EC2EbsDefaultKmsKeyId = Get-EC2EbsDefaultKmsKeyId -Region $_ } } | ` Format-Table -AutoSize
-
您不能變更與現有快照或加密磁碟區相關聯的 KMS 金鑰。但是,您可以在快照複製操作中建立與不同 KMS 金鑰 的關聯,讓複製後的快照使用新的 KMS 金鑰 來加密。
要求
輪換 KMS 金鑰