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 |
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 globalTable = new dynamodb.TableV2(stack, 'GlobalTable', {
partitionKey: { name: 'pk', type: dynamodb.AttributeType.STRING },
// applys to all replicas, i.e., us-west-2, us-east-1, us-east-2
removalPolicy: cdk.RemovalPolicy.DESTROY,
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. |
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. |
kinesis | IStream | Kinesis Data Stream to capture item level changes. |
local | Local [] | Local secondary indexes. |
point | boolean | Whether point-in-time recovery is enabled. |
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. |
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?
Type:
boolean
(optional, default: false)
Whether CloudWatch contributor insights is enabled.
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.
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.
pointInTimeRecovery?
Type:
boolean
(optional, default: false)
Whether point-in-time recovery is enabled.
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.