Skip to content
v2.273.0

TablePropsV2 Struct ​

Properties used to configure a DynamoDB table.

Example ​

ts
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' },
  ],
  witnessRegion: 'us-east-2',
});

Properties ​

billingBillingbillingBillingbillingBillingBillingBillingBillingBilling= Billing.onDemand()#
The billing mode and capacity settings to apply to the table.
contributorInsightsbooleancontributor_insightsboolcontributorInsightsBooleanContributorInsightsboolContributorInsights*bool= falsedeprecated#
use `contributorInsightsSpecification` instead
contributorInsightsSpecificationContributorInsightsSpecificationcontributor_insights_specificationContributorInsightsSpecificationcontributorInsightsSpecificationContributorInsightsSpecificationContributorInsightsSpecificationContributorInsightsSpecificationContributorInsightsSpecificationContributorInsightsSpecification= contributor insights is not enab…#
Whether CloudWatch contributor insights is enabled and what mode is selected.
default

Default: contributor insights is not enabled

deletionProtectionbooleandeletion_protectionbooldeletionProtectionBooleanDeletionProtectionboolDeletionProtection*bool= false#
Whether deletion protection is enabled.
dynamoStreamStreamViewTypedynamo_streamStreamViewTypedynamoStreamStreamViewTypeDynamoStreamStreamViewTypeDynamoStreamStreamViewType= streams are disabled if replicas…#
When an item in the table is modified, StreamViewType determines what information is written to the stream.
default

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

encryptionTableEncryptionV2encryptionTableEncryptionV2encryptionTableEncryptionV2EncryptionTableEncryptionV2EncryptionTableEncryptionV2= TableEncryptionV2.dynamoOwnedKey…#
The server-side encryption.
default

Default: TableEncryptionV2.dynamoOwnedKey()

globalSecondaryIndexesGlobalSecondaryIndexPropsV2[]global_secondary_indexestyping.List[GlobalSecondaryIndexPropsV2]globalSecondaryIndexesList<GlobalSecondaryIndexPropsV2>GlobalSecondaryIndexesGlobalSecondaryIndexPropsV2[]GlobalSecondaryIndexes*[]GlobalSecondaryIndexPropsV2= no global secondary indexes#
Global secondary indexes.

Note: You can provide a maximum of 20 global secondary indexes.

globalTableSettingsReplicationModeGlobalTableSettingsReplicationModeglobal_table_settings_replication_modeGlobalTableSettingsReplicationModeglobalTableSettingsReplicationModeGlobalTableSettingsReplicationModeGlobalTableSettingsReplicationModeGlobalTableSettingsReplicationModeGlobalTableSettingsReplicationModeGlobalTableSettingsReplicationMode= GlobalTableSettingsReplicationMo…#
Controls whether table settings are synchronized across replicas.
notes · default

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).

Default: GlobalTableSettingsReplicationMode.NONE

kinesisStreamIStreamkinesis_streamIStreamkinesisStreamIStreamKinesisStreamIStreamKinesisStreamIStream= no Kinesis Data Stream#
Kinesis Data Stream to capture item level changes.
localSecondaryIndexesLocalSecondaryIndexProps[]local_secondary_indexestyping.List[LocalSecondaryIndexProps]localSecondaryIndexesList<LocalSecondaryIndexProps>LocalSecondaryIndexesLocalSecondaryIndexProps[]LocalSecondaryIndexes*[]LocalSecondaryIndexProps= no local secondary indexes#
Local secondary indexes.

Note: You can only provide a maximum of 5 local secondary indexes.

multiRegionConsistencyMultiRegionConsistencymulti_region_consistencyMultiRegionConsistencymultiRegionConsistencyMultiRegionConsistencyMultiRegionConsistencyMultiRegionConsistencyMultiRegionConsistencyMultiRegionConsistency= MultiRegionConsistency.EVENTUAL#
Specifies the consistency mode for a new global table.
partitionKeyAttributepartition_keyAttributepartitionKeyAttributePartitionKeyAttributePartitionKeyAttributerequired#
Partition key attribute definition.
pointInTimeRecoverybooleanpoint_in_time_recoveryboolpointInTimeRecoveryBooleanPointInTimeRecoveryboolPointInTimeRecovery*bool= false - point in time recovery i…deprecated#
use `pointInTimeRecoverySpecification` instead
default

Default: false - point in time recovery is not enabled.

pointInTimeRecoverySpecificationPointInTimeRecoverySpecificationpoint_in_time_recovery_specificationPointInTimeRecoverySpecificationpointInTimeRecoverySpecificationPointInTimeRecoverySpecificationPointInTimeRecoverySpecificationPointInTimeRecoverySpecificationPointInTimeRecoverySpecificationPointInTimeRecoverySpecification= point in time recovery is not en…#
Whether point-in-time recovery is enabled and recoveryPeriodInDays is set.
default

Default: point in time recovery is not enabled.

removalPolicyRemovalPolicyremoval_policyRemovalPolicyremovalPolicyRemovalPolicyRemovalPolicyRemovalPolicyRemovalPolicyRemovalPolicy= RemovalPolicy.RETAIN#
The removal policy applied to the table.
replicasReplicaTableProps[]replicastyping.List[ReplicaTableProps]replicasList<ReplicaTableProps>ReplicasReplicaTableProps[]Replicas*[]ReplicaTableProps= no replica tables#
Replica tables to deploy with the primary table.
notes

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.

resourcePolicyPolicyDocumentresource_policyPolicyDocumentresourcePolicyPolicyDocumentResourcePolicyPolicyDocumentResourcePolicyPolicyDocument= No resource policy statements ar…#
Resource policy to assign to DynamoDB Table.
default

Default: No resource policy statements are added to the created table.

sortKeyAttributesort_keyAttributesortKeyAttributeSortKeyAttributeSortKeyAttribute= no sort key#
Sort key attribute definition.
streamResourcePolicyPolicyDocumentstream_resource_policyPolicyDocumentstreamResourcePolicyPolicyDocumentStreamResourcePolicyPolicyDocumentStreamResourcePolicyPolicyDocument= No resource policy statements ar…#
Resource policy to assign to DynamoDB Stream.
default

Default: No resource policy statements are added to the stream.

tableClassTableClasstable_classTableClasstableClassTableClassTableClassTableClassTableClassTableClass= TableClass.STANDARD#
The table class.
tableNamestringtable_namestrtableNameStringTableNamestringTableName*string= generated by CloudFormation#
The name of the table.
tagsCfnTag[]tagstyping.List[CfnTag]tagsList<CfnTag>TagsCfnTag[]Tags*[]CfnTag= no tags#
Tags to be applied to the primary table (default replica table).
timeToLiveAttributestringtime_to_live_attributestrtimeToLiveAttributeStringTimeToLiveAttributestringTimeToLiveAttribute*string= TTL is disabled#
The name of the TTL attribute.
warmThroughputWarmThroughputwarm_throughputWarmThroughputwarmThroughputWarmThroughputWarmThroughputWarmThroughputWarmThroughputWarmThroughput= no warm throughput is configured#
The warm throughput configuration for the table.
witnessRegionstringwitness_regionstrwitnessRegionStringWitnessRegionstringWitnessRegion*string= no witness region#
The witness Region for the MRSC global table.
notes

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.

Used as props by ​