You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(bootstrap): no longer creates KMS master key by default (#10365)
The modern bootstrap stack used to unconditionally create a KMS Customer
Master Key (CMK) for users. This incurs a $1/month charge for every user
of the CDK for every region and account they want to deploy in, which is
not acceptable if we're going to make this the default bootstrapping
experience in the future.
This PR switches off the creation of the CMK by default for new
bootstrap stacks. Bootstrap stacks that already exist can remove the
existing CMK by running:
```
cdk bootstrap --bootstrap-customer-key=false [aws://...]
```
This change is backwards compatible: updates to existing (modern)
bootstrap stacks will leave the current KMS key in place. To achieve
this, the new default is encoded into the CLI, not into the template.
Fixes#10115.
----
*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Copy file name to clipboardexpand all lines: packages/aws-cdk/bin/cdk.ts
+3-1
Original file line number
Diff line number
Diff line change
@@ -69,7 +69,8 @@ async function parseCommandLineArguments() {
69
69
.option('exclusively',{type: 'boolean',alias: 'e',desc: 'Only synthesize requested stacks, don\'t include dependencies'}))
70
70
.command('bootstrap [ENVIRONMENTS..]','Deploys the CDK toolkit stack into an AWS environment',yargs=>yargs
71
71
.option('bootstrap-bucket-name',{type: 'string',alias: ['b','toolkit-bucket-name'],desc: 'The name of the CDK toolkit bucket; bucket will be created and must not exist',default: undefined})
72
-
.option('bootstrap-kms-key-id',{type: 'string',desc: 'AWS KMS master key ID used for the SSE-KMS encryption',default: undefined})
72
+
.option('bootstrap-kms-key-id',{type: 'string',desc: 'AWS KMS master key ID used for the SSE-KMS encryption',default: undefined,conflicts: 'bootstrap-customer-key'})
73
+
.option('bootstrap-customer-key',{type: 'boolean',desc: 'Create a Customer Master Key (CMK) for the bootstrap bucket (you will be charged but can customize permissions, modern bootstrapping only)',default: undefined,conflicts: 'bootstrap-kms-key-id'})
73
74
.option('qualifier',{type: 'string',desc: 'Unique string to distinguish multiple bootstrap stacks',default: undefined})
74
75
.option('public-access-block-configuration',{type: 'boolean',desc: 'Block public access configuration on CDK toolkit bucket (enabled by default) ',default: undefined})
75
76
.option('tags',{type: 'array',alias: 't',desc: 'Tags to add for the stack (KEY=VALUE)',nargs: 1,requiresArg: true,default: []})
@@ -271,6 +272,7 @@ async function initCommandLine() {
thrownewError('You cannot pass \'--bootstrap-kms-key-id\' and \'--bootstrap-customer-key\' together. Specify one or the other');
85
+
}
86
+
80
87
// If people re-bootstrap, existing parameter values are reused so that people don't accidentally change the configuration
81
88
// on their bootstrap stack (this happens automatically in deployStack). However, to do proper validation on the
82
89
// combined arguments (such that if --trust has been given, --cloudformation-execution-policies is necessary as well)
@@ -93,15 +100,28 @@ export class Bootstrapper {
93
100
if(cloudFormationExecutionPolicies.length===0){
94
101
thrownewError('Please pass \'--cloudformation-execution-policies\' to specify deployment permissions. Try a managed policy of the form \'arn:aws:iam::aws:policy/<PolicyName>\'.');
95
102
}
96
-
// Remind people what the current settings are
103
+
104
+
// * If an ARN is given, that ARN. Otherwise:
105
+
// * '-' if customerKey = false
106
+
// * '' if customerKey = true
107
+
// * if customerKey is also not given
108
+
// * undefined if we already had a value in place (reusing what we had)
109
+
// * '-' if this is the first time we're deploying this stack (or upgrading from old to new bootstrap)
0 commit comments