interface TableProps
Language | Type name |
---|---|
![]() | Amazon.CDK.AWS.DynamoDB.TableProps |
![]() | software.amazon.awscdk.services.dynamodb.TableProps |
![]() | aws_cdk.aws_dynamodb.TableProps |
![]() | @aws-cdk/aws-dynamodb » TableProps |
Properties for a DynamoDB Table.
Example
const globalTable = new dynamodb.Table(this, 'Table', {
partitionKey: { name: 'id', type: dynamodb.AttributeType.STRING },
replicationRegions: ['us-east-1', 'us-east-2', 'us-west-2'],
billingMode: dynamodb.BillingMode.PROVISIONED,
});
globalTable.autoScaleWriteCapacity({
minCapacity: 1,
maxCapacity: 10,
}).scaleOnUtilization({ targetUtilizationPercent: 75 });
Properties
Name | Type | Description |
---|---|---|
partition | Attribute | Partition key attribute definition. |
billing | Billing | Specify how you are charged for read and write throughput and how you manage capacity. |
contributor | boolean | Whether CloudWatch contributor insights is enabled. |
encryption? | Table | Whether server-side encryption with an AWS managed customer master key is enabled. |
encryption | IKey | External KMS key to use for table encryption. |
kinesis | IStream | Kinesis Data Stream to capture item-level changes for the table. |
point | boolean | Whether point-in-time recovery is enabled. |
read | number | The read capacity for the table. |
removal | Removal | The removal policy to apply to the DynamoDB Table. |
replication | string[] | Regions where replica tables will be created. |
replication | Duration | The timeout for a table replication operation in a single region. |
server | boolean | Whether server-side encryption with an AWS managed customer master key is enabled. |
sort | Attribute | Sort key attribute definition. |
stream? | Stream | When an item in the table is modified, StreamViewType determines what information is written to the stream for this table. |
table | Table | Specify the table class. |
table | string | Enforces a particular physical table name. |
time | string | The name of TTL attribute. |
wait | boolean | Indicates whether CloudFormation stack waits for replication to finish. |
write | number | The write capacity for the table. |
partitionKey
Type:
Attribute
Partition key attribute definition.
billingMode?
Type:
Billing
(optional, default: PROVISIONED if replicationRegions
is not specified, PAY_PER_REQUEST otherwise)
Specify how you are charged for read and write throughput and how you manage capacity.
contributorInsightsEnabled?
Type:
boolean
(optional, default: false)
Whether CloudWatch contributor insights is enabled.
encryption?
Type:
Table
(optional, default: server-side encryption is enabled with an AWS owned customer master key)
Whether server-side encryption with an AWS managed customer master key is enabled.
This property cannot be set if serverSideEncryption
is set.
NOTE: if you set this to
CUSTOMER_MANAGED
andencryptionKey
is not specified, the key that the Tablet generates for you will be created with default permissions. If you are using CDKv2, these permissions will be sufficient to enable the key for use with DynamoDB tables. If you are using CDKv1, make sure the feature flag@aws-cdk/aws-kms:defaultKeyPolicies
is set totrue
in yourcdk.json
.
encryptionKey?
Type:
IKey
(optional, default: If encryption
is set to TableEncryption.CUSTOMER_MANAGED
and this
property is undefined, a new KMS key will be created and associated with this table.)
External KMS key to use for table encryption.
This property can only be set if encryption
is set to TableEncryption.CUSTOMER_MANAGED
.
kinesisStream?
Type:
IStream
(optional, default: no Kinesis Data Stream)
Kinesis Data Stream to capture item-level changes for the table.
pointInTimeRecovery?
Type:
boolean
(optional, default: point-in-time recovery is disabled)
Whether point-in-time recovery is enabled.
readCapacity?
Type:
number
(optional, default: 5)
The read capacity for the table.
Careful if you add Global Secondary Indexes, as those will share the table's provisioned throughput.
Can only be provided if billingMode is Provisioned.
removalPolicy?
Type:
Removal
(optional, default: RemovalPolicy.RETAIN)
The removal policy to apply to the DynamoDB Table.
replicationRegions?
Type:
string[]
(optional, default: no replica tables are created)
Regions where replica tables will be created.
replicationTimeout?
Type:
Duration
(optional, default: Duration.minutes(30))
The timeout for a table replication operation in a single region.
serverSideEncryption?
⚠️ Deprecated: This property is deprecated. In order to obtain the same behavior as
enabling this, set the encryption
property to TableEncryption.AWS_MANAGED
instead.
Type:
boolean
(optional, default: server-side encryption is enabled with an AWS owned customer master key)
Whether server-side encryption with an AWS managed customer master key is enabled.
This property cannot be set if encryption
and/or encryptionKey
is set.
sortKey?
Type:
Attribute
(optional, default: no sort key)
Sort key attribute definition.
stream?
Type:
Stream
(optional, default: streams are disabled unless replicationRegions
is specified)
When an item in the table is modified, StreamViewType determines what information is written to the stream for this table.
tableClass?
Type:
Table
(optional, default: STANDARD)
Specify the table class.
tableName?
Type:
string
(optional, default:
Enforces a particular physical table name.
timeToLiveAttribute?
Type:
string
(optional, default: TTL is disabled)
The name of TTL attribute.
waitForReplicationToFinish?
Type:
boolean
(optional, default: true)
Indicates whether CloudFormation stack waits for replication to finish.
If set to false, the CloudFormation resource will mark the resource as created and replication will be completed asynchronously. This property is ignored if replicationRegions property is not set.
DO NOT UNSET this property if adding/removing multiple replicationRegions in one deployment, as CloudFormation only supports one region replication at a time. CDK overcomes this limitation by waiting for replication to finish before starting new replicationRegion.
writeCapacity?
Type:
number
(optional, default: 5)
The write capacity for the table.
Careful if you add Global Secondary Indexes, as those will share the table's provisioned throughput.
Can only be provided if billingMode is Provisioned.