Skip to content
v2.274.0

TableEncryptionV2 Class ​

Represents server-side encryption for a DynamoDB table.

Example ​

ts
import * as cdk from 'aws-cdk-lib';
import * as kms from 'aws-cdk-lib/aws-kms';

const app = new cdk.App();
const stack = new cdk.Stack(app, 'Stack', { env: { region: 'us-west-2' } });

const tableKey = new kms.Key(stack, 'Key');
const replicaKeyArns = {
  'us-east-1': 'arn:aws:kms:us-east-1:123456789012:key/g24efbna-az9b-42ro-m3bp-cq249l94fca6',
  'us-east-2': 'arn:aws:kms:us-east-2:123456789012:key/h90bkasj-bs1j-92wp-s2ka-bh857d60bkj8',
};

const globalTable = new dynamodb.TableV2(stack, 'GlobalTable', {
  partitionKey: { name: 'pk', type: dynamodb.AttributeType.STRING },
  encryption: dynamodb.TableEncryptionV2.customerManagedKey(tableKey, replicaKeyArns),
  replicas: [
    { region: 'us-east-1' },
    { region: 'us-east-2' },
  ],
});

Properties ​

replicaKeyArnsmay be undefined{ [key: string]: string }replica_key_arnsmay be undefinedtyping.Mapping[str, str]replicaKeyArnsmay be undefinedMap<String, String>ReplicaKeyArnsmay be undefinedIDictionary<string, string>ReplicaKeyArnsmay be undefined*map[string]*string#
tableKeymay be undefinedIKeytable_keymay be undefinedIKeytableKeymay be undefinedIKeyTableKeymay be undefinedIKeyTableKeymay be undefinedIKey#

Methods ​

awsManagedKey(): TableEncryptionV2 // chainable@staticmethod def aws_managed_key() -> TableEncryptionV2public static TableEncryptionV2 awsManagedKey()public static TableEncryptionV2 AwsManagedKey()func AwsManagedKey() TableEncryptionV2static#
Configure server-side encryption using an AWS managed key.
customerManagedKey(tableKey: IKey, replicaKeyArns?: { [key: string]: string }): TableEncryptionV2 // chainable@staticmethod def customer_managed_key(table_key: IKey, replica_key_arns: typing.Optional[typing.Mapping[str, str]] = None) -> TableEncryptionV2public static TableEncryptionV2 customerManagedKey(IKey tableKey, Map<String, String> replicaKeyArns)public static TableEncryptionV2 CustomerManagedKey(IKey tableKey, IDictionary<string, string>? replicaKeyArns = null)func CustomerManagedKey(TableKey IKey, ReplicaKeyArns *map[string]*string) TableEncryptionV2static#
Configure server-side encryption using customer managed keys.
2 parameters

Parameters

  • tableKeytable_keytableKeytableKeyTableKey — the KMS key for the primary table.
  • replicaKeyArnsreplica_key_arnsreplicaKeyArnsreplicaKeyArnsReplicaKeyArns — an object containing the ARN of the KMS key to use for each replica table.
dynamoOwnedKey(): TableEncryptionV2 // chainable@staticmethod def dynamo_owned_key() -> TableEncryptionV2public static TableEncryptionV2 dynamoOwnedKey()public static TableEncryptionV2 DynamoOwnedKey()func DynamoOwnedKey() TableEncryptionV2static#
Configure server-side encryption using a DynamoDB owned key.