interface TablePropsV2
| Language | Type name |
|---|---|
.NET | Amazon.CDK.AWS.DynamoDB.TablePropsV2 |
Go | github.com/aws/aws-cdk-go/awscdk/v2/awsdynamodb#TablePropsV2 |
Java | software.amazon.awscdk.services.dynamodb.TablePropsV2 |
Python | aws_cdk.aws_dynamodb.TablePropsV2 |
TypeScript (source) | aws-cdk-lib » aws_dynamodb » TablePropsV2 |
Implements
Table
Properties used to configure a DynamoDB table.
Example
import * as cdk from 'aws-cdk-lib';
const app = new cdk.App();
const stack = new cdk.Stack(app, 'Stack', { env: { region: 'us-west-2' } });
const mrscTable = new dynamodb.TableV2(stack, 'MRSCTable', {
partitionKey: { name: 'pk', type: dynamodb.AttributeType.STRING },
multiRegionConsistency: dynamodb.MultiRegionConsistency.STRONG,
replicas: [
{ region: 'us-east-1' },
{ region: 'us-east-2' },
],
});
Properties
| Name | Type | Description |
|---|---|---|
| partition | Attribute | Partition key attribute definition. |
| billing? | Billing | The billing mode and capacity settings to apply to the table. |
| contributor | boolean | Whether CloudWatch contributor insights is enabled. |
| contributor | Contributor | Whether CloudWatch contributor insights is enabled and what mode is selected. |
| deletion | boolean | Whether deletion protection is enabled. |
| dynamo | Stream | When an item in the table is modified, StreamViewType determines what information is written to the stream. |
| encryption? | Table | The server-side encryption. |
| global | Global[] | Global secondary indexes. |
| global | Global | Controls whether table settings are synchronized across replicas. |
| kinesis | IStream | Kinesis Data Stream to capture item level changes. |
| local | Local[] | Local secondary indexes. |
| multi | Multi | Specifies the consistency mode for a new global table. |
| point | boolean | Whether point-in-time recovery is enabled. |
| point | Point | Whether point-in-time recovery is enabled and recoveryPeriodInDays is set. |
| removal | Removal | The removal policy applied to the table. |
| replicas? | Replica[] | Replica tables to deploy with the primary table. |
| resource | Policy | Resource policy to assign to DynamoDB Table. |
| sort | Attribute | Sort key attribute definition. |
| table | Table | The table class. |
| table | string | The name of the table. |
| tags? | Cfn[] | Tags to be applied to the primary table (default replica table). |
| time | string | The name of the TTL attribute. |
| warm | Warm | The warm throughput configuration for the table. |
| witness | string | The witness Region for the MRSC global table. |
partitionKey
Type:
Attribute
Partition key attribute definition.
billing?
Type:
Billing
(optional, default: Billing.onDemand())
The billing mode and capacity settings to apply to the table.
contributorInsights?
⚠️ Deprecated: use contributorInsightsSpecification instead
Type:
boolean
(optional, default: false)
Whether CloudWatch contributor insights is enabled.
contributorInsightsSpecification?
Type:
Contributor
(optional, default: contributor insights is not enabled)
Whether CloudWatch contributor insights is enabled and what mode is selected.
deletionProtection?
Type:
boolean
(optional, default: false)
Whether deletion protection is enabled.
dynamoStream?
Type:
Stream
(optional, default: streams are disabled if replicas are not configured and this property is
not specified. If this property is not specified when replicas are configured, then
NEW_AND_OLD_IMAGES will be the StreamViewType for all replicas)
When an item in the table is modified, StreamViewType determines what information is written to the stream.
encryption?
Type:
Table
(optional, default: TableEncryptionV2.dynamoOwnedKey())
The server-side encryption.
globalSecondaryIndexes?
Type:
Global[]
(optional, default: no global secondary indexes)
Global secondary indexes.
Note: You can provide a maximum of 20 global secondary indexes.
globalTableSettingsReplicationMode?
Type:
Global
(optional, default: GlobalTableSettingsReplicationMode.NONE)
Controls whether table settings are synchronized across replicas.
When set to ALL, synchronizable settings (billing mode, throughput, TTL, streams view type, GSIs) are automatically replicated across all replicas. When set to NONE, each replica manages its own settings independently (billing mode must be PAY_PER_REQUEST).
Note: Some settings are always synchronized (key schema, LSIs) regardless of this setting, and some are never synchronized (table class, SSE, deletion protection, PITR, tags, resource policy).
kinesisStream?
Type:
IStream
(optional, default: no Kinesis Data Stream)
Kinesis Data Stream to capture item level changes.
localSecondaryIndexes?
Type:
Local[]
(optional, default: no local secondary indexes)
Local secondary indexes.
Note: You can only provide a maximum of 5 local secondary indexes.
multiRegionConsistency?
Type:
Multi
(optional, default: MultiRegionConsistency.EVENTUAL)
Specifies the consistency mode for a new global table.
pointInTimeRecovery?
⚠️ Deprecated: use pointInTimeRecoverySpecification instead
Type:
boolean
(optional, default: false - point in time recovery is not enabled.)
Whether point-in-time recovery is enabled.
pointInTimeRecoverySpecification?
Type:
Point
(optional, default: point in time recovery is not enabled.)
Whether point-in-time recovery is enabled and recoveryPeriodInDays is set.
removalPolicy?
Type:
Removal
(optional, default: RemovalPolicy.RETAIN)
The removal policy applied to the table.
replicas?
Type:
Replica[]
(optional, default: no replica tables)
Replica tables to deploy with the primary table.
Note: Adding replica tables allows you to use your table as a global table. You cannot specify a replica table in the region that the primary table will be deployed to. Replica tables will only be supported if the stack deployment region is defined.
resourcePolicy?
Type:
Policy
(optional, default: No resource policy statements are added to the created table.)
Resource policy to assign to DynamoDB Table.
sortKey?
Type:
Attribute
(optional, default: no sort key)
Sort key attribute definition.
tableClass?
Type:
Table
(optional, default: TableClass.STANDARD)
The table class.
tableName?
Type:
string
(optional, default: generated by CloudFormation)
The name of the table.
tags?
Type:
Cfn[]
(optional, default: no tags)
Tags to be applied to the primary table (default replica table).
timeToLiveAttribute?
Type:
string
(optional, default: TTL is disabled)
The name of the TTL attribute.
warmThroughput?
Type:
Warm
(optional, default: no warm throughput is configured)
The warm throughput configuration for the table.
witnessRegion?
Type:
string
(optional, default: no witness region)
The witness Region for the MRSC global table.
A MRSC global table can be configured with either three replicas, or with two replicas and one witness.
Note: Witness region cannot be specified for a Multi-Region Eventual Consistency (MREC) Global Table. Witness regions are only supported for Multi-Region Strong Consistency (MRSC) Global Tables.

.NET
Go
Java
Python
TypeScript (