Skip to content

Commit 662c42b

Browse files
committed
Add AccountRootPrincipal ARN as KMS key user
This enables IAM policies to allow access to the CMK used for snapshot export encryption, such as for the account administrator or a user assuming an authorized IAM role. As is the case with the default KMS key policy, this alone does not grant access to the key itself. See: https://docs.aws.amazon.com/kms/latest/developerguide/key-policies.html#key-policy-default
1 parent 0e84cc0 commit 662c42b

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

lib/rds-snapshot-export-pipeline-stack.ts

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as cdk from "@aws-cdk/core";
22
import * as path from "path";
33
import {CfnCrawler} from "@aws-cdk/aws-glue";
4-
import {ManagedPolicy, PolicyDocument, Role, ServicePrincipal} from "@aws-cdk/aws-iam";
4+
import {ManagedPolicy, PolicyDocument, Role, ServicePrincipal, AccountRootPrincipal} from "@aws-cdk/aws-iam";
55
import {Code, Function, Runtime} from "@aws-cdk/aws-lambda";
66
import {SnsEventSource} from "@aws-cdk/aws-lambda-event-sources";
77
import {Key} from "@aws-cdk/aws-kms";
@@ -131,7 +131,11 @@ export class RdsSnapshotExportPipelineStack extends cdk.Stack {
131131
"Statement": [
132132
{
133133
"Principal": {
134-
"AWS": [lambdaExecutionRole.roleArn, snapshotExportGlueCrawlerRole.roleArn]
134+
"AWS": [
135+
(new AccountRootPrincipal()).arn,
136+
lambdaExecutionRole.roleArn,
137+
snapshotExportGlueCrawlerRole.roleArn
138+
]
135139
},
136140
"Action": [
137141
"kms:Encrypt",

0 commit comments

Comments
 (0)