Skip to content

Commit 164d50b

Browse files
authored
docs(dynamodb): add note around table encryption (#18721)
Whether creating a Table with a custom KMS key succeeds depends on the permissions on the key. The default permissions are correct, but only if the appropriate feature flag is set. Without changing code yet, add the caveat on proper configuration to the documentation. Fixes #18616 ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
1 parent c6b3383 commit 164d50b

File tree

1 file changed

+13
-0
lines changed
  • packages/@aws-cdk/aws-dynamodb/lib

1 file changed

+13
-0
lines changed

packages/@aws-cdk/aws-dynamodb/lib/table.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,12 @@ export enum TableEncryption {
117117
/**
118118
* Server-side KMS encryption with a customer master key managed by customer.
119119
* If `encryptionKey` is specified, this key will be used, otherwise, one will be defined.
120+
*
121+
* > **NOTE**: if `encryptionKey` is not specified and the `Table` construct creates
122+
* > a KMS key for you, the key will be created with default permissions. If you are using
123+
* > CDKv2, these permissions will be sufficient to enable the key for use with DynamoDB tables.
124+
* > If you are using CDKv1, make sure the feature flag `@aws-cdk/aws-kms:defaultKeyPolicies`
125+
* > is set to `true` in your `cdk.json`.
120126
*/
121127
CUSTOMER_MANAGED = 'CUSTOMER_MANAGED',
122128

@@ -198,6 +204,13 @@ export interface TableOptions extends SchemaOptions {
198204
*
199205
* This property cannot be set if `serverSideEncryption` is set.
200206
*
207+
* > **NOTE**: if you set this to `CUSTOMER_MANAGED` and `encryptionKey` is not
208+
* > specified, the key that the Tablet generates for you will be created with
209+
* > default permissions. If you are using CDKv2, these permissions will be
210+
* > sufficient to enable the key for use with DynamoDB tables. If you are
211+
* > using CDKv1, make sure the feature flag
212+
* > `@aws-cdk/aws-kms:defaultKeyPolicies` is set to `true` in your `cdk.json`.
213+
*
201214
* @default - server-side encryption is enabled with an AWS owned customer master key
202215
*/
203216
readonly encryption?: TableEncryption;

0 commit comments

Comments
 (0)