CMK 的跨帳戶整合考量 - Amazon DynamoDB

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

CMK 的跨帳戶整合考量

當您嘗試從 DynamoDB 整合到 Amazon Redshift 時,初始動作會從 Amazon Redshift 啟動。如果沒有適當的許可,此動作可能會導致靜音失敗。下列各節詳細說明此跨帳戶整合所需的許可。

必要的 AWS KMS 政策和許可

取代範例中的下列預留位置:

  • REDSHIFT_ACCOUNT_ID:託管 Amazon Redshift 的 AWS 帳戶 ID

  • DYNAMODB_ACCOUNT_ID:託管 DynamoDB 的 AWS 帳戶 ID

  • REDSHIFT_ROLE_NAME:Amazon Redshift 使用的 IAM 角色名稱

  • REGION: AWS 區域 您的資源所在的 。

  • TABLE_NAME:DynamoDB 資料表的名稱

  • KMS_KEY_ID:KMS 金鑰的 ID

DynamoDB 帳戶中的 KMS 金鑰政策

{ "Version": "2012-10-17", "Statement": [ { "Sid": "Enable IAM User Permissions", "Effect": "Allow", "Principal": { "AWS": "arn:aws:iam::DYNAMODB_ACCOUNT_ID:root" }, "Action": "kms:*", "Resource": "*" }, { "Sid": "Allow Redshift to use the key", "Effect": "Allow", "Principal": { "AWS": "arn:aws:iam::REDSHIFT_ACCOUNT_ID:role/REDSHIFT_ROLE_NAME" }, "Action": [ "kms:Decrypt", "kms:DescribeKey", "kms:GenerateDataKey", "kms:GenerateDataKeyWithoutPlaintext" ], "Resource": "*" } ] }

Amazon Redshift 角色的 IAM 政策 (在 Amazon Redshift 帳戶中)

{ "Version": "2012-10-17", "Statement": [ { "Sid": "AllowDynamoDBAccess", "Effect": "Allow", "Action": [ "dynamodb:DescribeTable", "dynamodb:ParitalBatchGetItem", "dynamodb:Scan", "dynamodb:Query", "dynamodb:BatchGetItem", "dynamodb:GetItem", "dynamodb:GetRecords", "dynamodb:GetShardIterator", "dynamodb:DescribeStream", "dynamodb:ListStreams" ], "Resource": [ "arn:aws:dynamodb:REGION:DYNAMODB_ACCOUNT_ID:table/TABLE_NAME", "arn:aws:dynamodb:REGION:DYNAMODB_ACCOUNT_ID:table/TABLE_NAME/stream/*" ] }, { "Sid": "AllowKMSAccess", "Effect": "Allow", "Action": [ "kms:Decrypt", "kms:DescribeKey", "kms:GenerateDataKey", "kms:GenerateDataKeyWithoutPlaintext" ], "Resource": "arn:aws:kms:REGION:DYNAMODB_ACCOUNT_ID:key/KMS_KEY_ID" } ] }

Amazon Redshift 角色的信任關係

{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Principal": { "Service": "redshift.amazonaws.com" }, "Action": "sts:AssumeRole" } ] }

DynamoDB 資料表政策 (如果使用以資源為基礎的政策)

{ "Version": "2012-10-17", "Statement": [ { "Sid": "AllowRedshiftAccess", "Effect": "Allow", "Principal": { "AWS": "arn:aws:iam::REDSHIFT_ACCOUNT_ID:role/REDSHIFT_ROLE_NAME" }, "Action": [ "dynamodb:DescribeTable", "dynamodb:ParitalBatchGetItem", "dynamodb:Scan", "dynamodb:Query", "dynamodb:BatchGetItem", "dynamodb:GetItem", "dynamodb:GetRecords", "dynamodb:GetShardIterator", "dynamodb:DescribeStream", "dynamodb:ListStreams" ], "Resource": [ "arn:aws:dynamodb:REGION:DYNAMODB_ACCOUNT_ID:table/TABLE_NAME", "arn:aws:dynamodb:REGION:DYNAMODB_ACCOUNT_ID:table/TABLE_NAME/stream/*" ] } ] }

重要考量

  1. 確保 KMS 金鑰與您的 DynamoDB 資料表位於相同的區域。

  2. KMS 金鑰必須是客戶受管金鑰 (CMK),而不是 AWS 受管金鑰。

  3. 如果您使用的是 DynamoDB 全域資料表,請設定所有相關區域的許可。

  4. 考慮新增條件陳述式,以根據 VPC 端點或 IP 範圍限制存取。

  5. 為了增強安全性,請考慮使用 aws:PrincipalOrgID 條件來限制對組織的存取。

  6. 透過 CloudTrail 和 CloudWatch 指標監控 KMS 金鑰用量。