gpt4 book ai didi

How can I downscope customer managed key for dynamodb with CDK (using encryption context)?(如何使用CDK缩小DynamoDB客户管理密钥的范围(使用加密上下文)?)

转载 作者:bug小助手 更新时间:2023-10-25 11:20:50 26 4
gpt4 key购买 nike



I am trying to create a key for my application's dynamodb tables. The documentation requires an actual principal, which I dont have when using CDK.

我正在尝试为我的应用程序的DynamoDB表创建一个键。文档需要一个实际的主体,而我在使用CDK时没有。


{
"Id": "key-policy-dynamodb",
"Version":"2012-10-17",
"Statement": [
{
"Sid" : "Allow access through Amazon DynamoDB for all principals in the account that are authorized to use Amazon DynamoDB",
"Effect": "Allow",
"Principal": {"AWS": "arn:aws:iam::111122223333:user/db-lead"},
"Action": [
"kms:Encrypt",
"kms:Decrypt",
"kms:ReEncrypt*",
"kms:GenerateDataKey*",
"kms:DescribeKey",
"kms:CreateGrant"
],
"Resource": "*",
"Condition": {
"StringLike": {
"kms:ViaService" : "dynamodb.*.amazonaws.com"
}
}
},
{
"Sid": "Allow administrators to view the KMS key and revoke grants",
"Effect": "Allow",
"Principal": {
"AWS": "arn:aws:iam::111122223333:role/db-team"
},
"Action": [
"kms:Describe*",
"kms:Get*",
"kms:List*",
"kms:RevokeGrant"
],
"Resource": "*"
}
]
}

Interestingly, the default policy from CDK also works just fine:

有趣的是,CDK的默认策略也运行得很好:


{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"AWS": "arn:aws:iam::111122223333:root"
},
"Action": "kms:*",
"Resource": "*"
}
]
}

So my question is: Is there any way I can downscope this permission when using CDK? And also use the encryption context to downscope the permissions to specific tables?

所以我的问题是:在使用CDK时,我有什么方法可以缩小权限的范围吗?并且还使用加密上下文将权限范围缩小到特定表?


"encryptionContextSubset": {
"aws:dynamodb:tableName": "Books"
"aws:dynamodb:subscriberId": "111122223333"
}

When I use the example from the documentation with Princiapl "*" for the first and the account root for the second, I get The new key policy will not allow you to update the key policyy in the future.

当我使用文档中的示例时,第一个是Princiapl“*”,第二个是帐户根,我得到了新的密钥策略将不允许您在将来更新密钥策略。


更多回答
优秀答案推荐
更多回答

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com