本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。
如果您在 客戶受管金鑰 帳戶中使用 來保護您的 EventBridge 資源, 上的政策 KMS key 必須授予代表您使用 資源的 EventBridge 許可。您可以在金鑰政策中提供這些許可。
EventBridge 不需要額外的授權,即可使用預設值 AWS 擁有的金鑰 來保護您 AWS 帳戶中 EventBridge 的資源。
EventBridge 需要下列許可才能使用 客戶受管金鑰:
-
EventBridge 需要此許可,才能擷取所提供金鑰 ID 的 KMS key ARN,並確認金鑰是對稱的。
-
EventBridge 需要此許可,才能產生資料金鑰做為資料的加密金鑰。
-
EventBridge 需要此許可,才能解密已加密的資料金鑰,並使用加密的資料存放。
EventBridge 會使用此項目進行事件模式比對;使用者永遠無法存取資料。
AWS KMS 事件匯流排的金鑰政策
下列範例金鑰政策提供事件匯流排的必要許可:
kms:DescribeKey
kms:GenerateDataKey
kms:Decrypt
{ "Sid": "Allow EventBridge to encrypt events", "Effect": "Allow", "Principal": { "Service": "events.amazonaws.com" }, "Action": [ "kms:DescribeKey", "kms:GenerateDataKey", "kms:Decrypt" ] "Resource": "*", "Condition": { "StringEquals": { "kms:EncryptionContext:aws:events:event-bus:arn": "arn:aws:events:
region
:account-id
:event-bus/event-bus-arn
", "aws:SourceArn": "arn:aws:events:region
:account-id
:event-bus/event-bus-name
" } } }
AWS KMS EventBridge 管道的金鑰政策
下列範例金鑰政策提供管道所需的許可:
kms:DescribeKey
kms:GenerateDataKey
kms:Decrypt
{ "Id": "CMKKeyPolicy", "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Principal": { "AWS": "arn:aws:iam::
account-id
:role/pipe-execution-role" }, "Action": [ "kms:GenerateDataKey", "kms:Decrypt", "kms:DescribeKey" ], "Resource": "*", "Condition": { "ArnLike": { "kms:EncryptionContext:aws:pipe:arn": "arn:aws:pipes:region
:account-id
:pipe/pipe-name
" }, "ForAnyValues:StringEquals": { // Requires that only PipeArn is passed in the encryption context "kms:EncryptionContextKeys": [ "aws:pipe:arn" ] } } } ] }
包含執行資料的管道日誌許可
如果您已將管道記錄設定為包含執行資料,則金鑰政策必須包含記錄服務的下列許可:
kms:Decrypt
kms:GenerateDataKey
如需詳細資訊,請參閱在 EventBridge 管道記錄中包含執行資料。
下列範例金鑰政策提供管道記錄的必要許可:
{ "Sid": "Enable log service encryption", "Effect": "Allow", "Principal": { "Service": "delivery.logs.amazonaws.com" }, "Action": [ "kms:Decrypt", "kms:GenerateDataKey" ], "Resource": "*", "Condition": { "StringLike": { "kms:EncryptionContext:SourceArn": "arn:
partition
:logs:region
:account
:*" } } }
此外,管道執行角色需要 kms:GenerateDataKey
許可。
{ "Sid": "Enable log service encryption", "Effect": "Allow", "Principal": { "AWS": "arn:aws:iam::
account
:role/pipe-execution-role" }, "Action": [ "kms:GenerateDataKey" ], "Resource": "*", "Condition": { "StringLike": { "kms:EncryptionContext:SourceArn": "arn:partition
:logs:region
:account
:*" } } }
管道執行角色也應包含:
"Action": [ "kms:GenerateDataKey" ], "Resource": "
key-arn
", "Condition": { "StringLike": { "kms:EncryptionContext:SourceArn": "arn:partition
:logs:region
:account
:*" } }
使用 客戶受管金鑰 進行 EventBridge 事件匯流排加密時的安全性
作為安全最佳實務,請將 aws:SourceArn
、 aws:sourceAccount
或 kms:EncryptionContext:aws:events:event-bus:arn
條件金鑰新增至 AWS KMS 金鑰政策。 IAM 全域條件金鑰有助於確保 EventBridge 僅對指定的匯流排或帳戶使用 KMS 金鑰。
下列範例示範如何在 IAM 政策中遵循此最佳實務:
{ "Sid": "Allow the use of key", "Effect": "Allow", "Principal": { "Service": "events.amazonaws.com" }, "Action": [ "kms:GenerateDataKey", "kms:Decrypt" ], "Resource": "*", "Condition" : { "StringEquals": { "aws:SourceAccount": "arn:aws:events:
region
:account-id
", "aws:SourceArn": "arn:aws:events:region
:account-id
:event-bus/event-bus-name
", "kms:EncryptionContext:aws:events:event-bus:arn": "arn:aws:events:region
:account-id
:event-bus/event-bus-arn
" } }