TablePropsV2
- class aws_cdk.aws_dynamodb.TablePropsV2(*, contributor_insights=None, deletion_protection=None, kinesis_stream=None, point_in_time_recovery=None, resource_policy=None, table_class=None, tags=None, partition_key, billing=None, dynamo_stream=None, encryption=None, global_secondary_indexes=None, local_secondary_indexes=None, removal_policy=None, replicas=None, sort_key=None, table_name=None, time_to_live_attribute=None)
Bases:
TableOptionsV2
Properties used to configure a DynamoDB table.
- Parameters:
contributor_insights (
Optional
[bool
]) – Whether CloudWatch contributor insights is enabled. Default: falsedeletion_protection (
Optional
[bool
]) – Whether deletion protection is enabled. Default: falsekinesis_stream (
Optional
[IStream
]) – Kinesis Data Stream to capture item level changes. Default: - no Kinesis Data Streampoint_in_time_recovery (
Optional
[bool
]) – Whether point-in-time recovery is enabled. Default: falseresource_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.STANDARDtags (
Optional
[Sequence
[Union
[CfnTag
,Dict
[str
,Any
]]]]) – Tags to be applied to the primary table (default replica table). Default: - no tagspartition_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 replicasencryption (
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 indexeslocal_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 indexesremoval_policy (
Optional
[RemovalPolicy
]) – The removal policy applied to the table. Default: RemovalPolicy.RETAINreplicas (
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 tablessort_key (
Union
[Attribute
,Dict
[str
,Any
],None
]) – Sort key attribute definition. Default: - no sort keytable_name (
Optional
[str
]) – The name of the table. Default: - generated by CloudFormationtime_to_live_attribute (
Optional
[str
]) – The name of the TTL attribute. Default: - TTL is disabled
- ExampleMetadata:
infused
Example:
import aws_cdk as cdk app = cdk.App() stack = cdk.Stack(app, "Stack", env=cdk.Environment(region="us-west-2")) global_table = dynamodb.TableV2(stack, "GlobalTable", partition_key=dynamodb.Attribute(name="pk", type=dynamodb.AttributeType.STRING), # applys to all replicas, i.e., us-west-2, us-east-1, us-east-2 removal_policy=cdk.RemovalPolicy.DESTROY, 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
Whether CloudWatch contributor insights is enabled.
- Default:
false
- 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
- 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
- partition_key
Partition key attribute definition.
- point_in_time_recovery
Whether point-in-time recovery is enabled.
- Default:
false
- 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:
- 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