使用密钥加密 Pi AWS KMS p EventBridge es 数据 - Amazon EventBridge

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

使用密钥加密 Pi AWS KMS p EventBridge es 数据

您可以指定 EventBridge 使用 a 客户托管式密钥 来加密静态存储的管道数据,而不是使用 a AWS 拥有的密钥 s 作为默认值。可以在创建或更新管道 客户托管式密钥 时指定。有关密钥类型的更多信息,请参阅 KMS key 选项

静 EventBridge 态加密的管道数据包括:

EventBridge 管道加密上下文

加密上下文 是一组包含任意非机密数据的键值对。在请求中包含加密上下文以加密数据时, AWS KMS 以加密方式将加密上下文绑定到加密的数据。要解密数据,您必须传入相同的加密上下文。

您还可以将加密上下文用作在策略和授权中进行授权的条件。

如果您使用客户托管密钥来保护您的 EventBridge 资源,则可以使用加密上下文来识别审计记录和日志 KMS key 中的使用情况。它也以明文形式显示在日志中,例如 AWS CloudTrailAmazon CloudWatch Logs

对于 Pip EventBridge es,在所有加密操作中 EventBridge 使用相同的 AWS KMS 加密上下文。该上下文包括单个键值对,其中包含管道 ARN。

"encryptionContext": { "kms:EncryptionContext:aws:pipes:arn": "pipe-arn" }

对于已售日志, EventBridge 使用以下加密上下文。

"encryptionContext": { "kms:EncryptionContext:SourceArn": "arn:partition:logs:region:account:*" }

AWS KMS Pip EventBridge es 的关键政策

以下示例密钥策略提供管道所需的权限:

  • kms:DescribeKey

  • kms:GenerateDataKey

  • kms:Decrypt

作为安全最佳实践,我们建议您在密钥策略中包含条件密钥,以帮助确保仅对指定的资源或账户 EventBridge 使用 KMS 密钥。有关更多信息,请参阅 安全性注意事项

{ "Id": "CMKKeyPolicy", "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Principal": { "AWS": "arn:aws:iam::account-id:role/pipe-execution-role" }, "Action": [ "kms:DescribeKey" ], "Resource": "*" }, { "Effect": "Allow", "Principal": { "AWS": "arn:aws:iam::account-id:role/pipe-execution-role" }, "Action": [ "kms:GenerateDataKey", "kms:Decrypt" ], "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

有关更多信息,请参阅 在 Pip EventBridge es 日志中包含执行数据

以下示例密钥策略提供管道日志记录所需的权限:

{ "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:*" } }