TablePropsV2

class aws_cdk.aws_dynamodb.TablePropsV2(*, contributor_insights=None, contributor_insights_specification=None, deletion_protection=None, kinesis_stream=None, point_in_time_recovery=None, point_in_time_recovery_specification=None, resource_policy=None, table_class=None, tags=None, partition_key, billing=None, dynamo_stream=None, encryption=None, global_secondary_indexes=None, global_table_settings_replication_mode=None, local_secondary_indexes=None, multi_region_consistency=None, removal_policy=None, replicas=None, sort_key=None, table_name=None, time_to_live_attribute=None, warm_throughput=None, witness_region=None)

Bases: TableOptionsV2

Properties used to configure a DynamoDB table.

Parameters:
  • contributor_insights (Optional[bool]) – (deprecated) Whether CloudWatch contributor insights is enabled. Default: false

  • contributor_insights_specification (Union[ContributorInsightsSpecification, Dict[str, Any], None]) – Whether CloudWatch contributor insights is enabled and what mode is selected. Default: - contributor insights is not enabled

  • deletion_protection (Optional[bool]) – Whether deletion protection is enabled. Default: false

  • kinesis_stream (Optional[IStream]) – Kinesis Data Stream to capture item level changes. Default: - no Kinesis Data Stream

  • point_in_time_recovery (Optional[bool]) – (deprecated) Whether point-in-time recovery is enabled. Default: false - point in time recovery is not enabled.

  • point_in_time_recovery_specification (Union[PointInTimeRecoverySpecification, Dict[str, Any], None]) – Whether point-in-time recovery is enabled and recoveryPeriodInDays is set. Default: - point in time recovery is not enabled.

  • resource_policy (Optional[PolicyDocument]) – Resource policy to assign to DynamoDB Table. Default: - No resource policy statements are added to the created table.

  • table_class (Optional[TableClass]) – The table class. Default: TableClass.STANDARD

  • tags (Optional[Sequence[Union[CfnTag, Dict[str, Any]]]]) – Tags to be applied to the primary table (default replica table). Default: - no tags

  • partition_key (Union[Attribute, Dict[str, Any]]) – Partition key attribute definition.

  • billing (Optional[Billing]) – The billing mode and capacity settings to apply to the table. Default: Billing.onDemand()

  • dynamo_stream (Optional[StreamViewType]) – When an item in the table is modified, StreamViewType determines what information is written to the stream. 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

  • encryption (Optional[TableEncryptionV2]) – The server-side encryption. Default: TableEncryptionV2.dynamoOwnedKey()

  • global_secondary_indexes (Optional[Sequence[Union[GlobalSecondaryIndexPropsV2, Dict[str, Any]]]]) – Global secondary indexes. Note: You can provide a maximum of 20 global secondary indexes. Default: - no global secondary indexes

  • global_table_settings_replication_mode (Optional[GlobalTableSettingsReplicationMode]) – 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). Default: GlobalTableSettingsReplicationMode.NONE

  • local_secondary_indexes (Optional[Sequence[Union[LocalSecondaryIndexProps, Dict[str, Any]]]]) – Local secondary indexes. Note: You can only provide a maximum of 5 local secondary indexes. Default: - no local secondary indexes

  • multi_region_consistency (Optional[MultiRegionConsistency]) – Specifies the consistency mode for a new global table. Default: MultiRegionConsistency.EVENTUAL

  • removal_policy (Optional[RemovalPolicy]) – The removal policy applied to the table. Default: RemovalPolicy.RETAIN

  • replicas (Optional[Sequence[Union[ReplicaTableProps, Dict[str, Any]]]]) – 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. Default: - no replica tables

  • sort_key (Union[Attribute, Dict[str, Any], None]) – Sort key attribute definition. Default: - no sort key

  • table_name (Optional[str]) – The name of the table. Default: - generated by CloudFormation

  • time_to_live_attribute (Optional[str]) – The name of the TTL attribute. Default: - TTL is disabled

  • warm_throughput (Union[WarmThroughput, Dict[str, Any], None]) – The warm throughput configuration for the table. Default: - no warm throughput is configured

  • witness_region (Optional[str]) – 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. Default: - no witness region

ExampleMetadata:

infused

Example:

import aws_cdk as cdk


app = cdk.App()
stack = cdk.Stack(app, "Stack", env=cdk.Environment(region="us-west-2"))

mrsc_table = dynamodb.TableV2(stack, "MRSCTable",
    partition_key=dynamodb.Attribute(name="pk", type=dynamodb.AttributeType.STRING),
    multi_region_consistency=dynamodb.MultiRegionConsistency.STRONG,
    replicas=[dynamodb.ReplicaTableProps(region="us-east-1"), dynamodb.ReplicaTableProps(region="us-east-2")
    ]
)

Attributes

billing

The billing mode and capacity settings to apply to the table.

Default:

Billing.onDemand()

contributor_insights

(deprecated) Whether CloudWatch contributor insights is enabled.

Default:

false

Deprecated:

use contributorInsightsSpecification instead

Stability:

deprecated

contributor_insights_specification

Whether CloudWatch contributor insights is enabled and what mode is selected.

Default:
  • contributor insights is not enabled

deletion_protection

Whether deletion protection is enabled.

Default:

false

dynamo_stream

When an item in the table is modified, StreamViewType determines what information is written to the stream.

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

encryption

The server-side encryption.

Default:

TableEncryptionV2.dynamoOwnedKey()

global_secondary_indexes

Global secondary indexes.

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

Default:
  • no global secondary indexes

global_table_settings_replication_mode

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

Default:

GlobalTableSettingsReplicationMode.NONE

kinesis_stream

Kinesis Data Stream to capture item level changes.

Default:
  • no Kinesis Data Stream

local_secondary_indexes

Local secondary indexes.

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

Default:
  • no local secondary indexes

multi_region_consistency

Specifies the consistency mode for a new global table.

Default:

MultiRegionConsistency.EVENTUAL

partition_key

Partition key attribute definition.

point_in_time_recovery

(deprecated) Whether point-in-time recovery is enabled.

Default:

false - point in time recovery is not enabled.

Deprecated:

use pointInTimeRecoverySpecification instead

Stability:

deprecated

point_in_time_recovery_specification

Whether point-in-time recovery is enabled and recoveryPeriodInDays is set.

Default:
  • point in time recovery is not enabled.

removal_policy

The removal policy applied to the table.

Default:

RemovalPolicy.RETAIN

replicas

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.

Default:
  • no replica tables

resource_policy

Resource policy to assign to DynamoDB Table.

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

See:

https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-dynamodb-globaltable-replicaspecification.html#cfn-dynamodb-globaltable-replicaspecification-resourcepolicy

sort_key

Sort key attribute definition.

Default:
  • no sort key

table_class

The table class.

Default:

TableClass.STANDARD

table_name

The name of the table.

Default:
  • generated by CloudFormation

tags

Tags to be applied to the primary table (default replica table).

Default:
  • no tags

time_to_live_attribute

The name of the TTL attribute.

Default:
  • TTL is disabled

warm_throughput

The warm throughput configuration for the table.

Default:
  • no warm throughput is configured

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.

Default:
  • no witness region