TableProps Struct
Properties for a DynamoDB Table.
Example
import * as eventsources from 'aws-cdk-lib/aws-lambda-event-sources';
import * as dynamodb from 'aws-cdk-lib/aws-dynamodb';
import { Key } from 'aws-cdk-lib/aws-kms';
declare const fn: lambda.Function;
const table = new dynamodb.Table(this, 'Table', {
partitionKey: {
name: 'id',
type: dynamodb.AttributeType.STRING,
},
stream: dynamodb.StreamViewType.NEW_IMAGE,
});
// Your self managed KMS key
const myKey = Key.fromKeyArn(
this,
'SourceBucketEncryptionKey',
'arn:aws:kms:us-east-1:123456789012:key/<key-id>',
);
fn.addEventSource(new eventsources.DynamoEventSource(table, {
startingPosition: lambda.StartingPosition.LATEST,
filters: [lambda.FilterCriteria.filter({ eventName: lambda.FilterRule.isEqual('INSERT') })],
filterEncryption: myKey,
}));
Properties
billingModeBillingModebilling_modeBillingModebillingModeBillingModeBillingModeBillingModeBillingModeBillingMode= PROVISIONED if `replicationRegio…#default
Default: PROVISIONED if replicationRegions is not specified, PAY_PER_REQUEST otherwise
contributorInsightsEnabledbooleancontributor_insights_enabledboolcontributorInsightsEnabledBooleanContributorInsightsEnabledboolContributorInsightsEnabled*bool= falsedeprecated#contributorInsightsSpecificationContributorInsightsSpecificationcontributor_insights_specificationContributorInsightsSpecificationcontributorInsightsSpecificationContributorInsightsSpecificationContributorInsightsSpecificationContributorInsightsSpecificationContributorInsightsSpecificationContributorInsightsSpecification= contributor insights is not enab…#default
Default: contributor insights is not enabled
deletionProtectionbooleandeletion_protectionbooldeletionProtectionBooleanDeletionProtectionboolDeletionProtection*bool= false#encryptionTableEncryptionencryptionTableEncryptionencryptionTableEncryptionEncryptionTableEncryptionEncryptionTableEncryption= The table is encrypted with an e…#notes · default
This property cannot be set if serverSideEncryption is set.
NOTE: if you set this to
CUSTOMER_MANAGEDandencryptionKeyis 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:defaultKeyPoliciesis set totruein yourcdk.json.
Default: The table is encrypted with an encryption key managed by DynamoDB, and you are not charged any fee for using it.
encryptionKeyIKeyencryption_keyIKeyencryptionKeyIKeyEncryptionKeyIKeyEncryptionKeyIKey= If `encryption` is set to `Table…#This property can only be set if encryption is set to TableEncryption.CUSTOMER_MANAGED.
default
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. If encryption and this property are both undefined, then the table is encrypted with an encryption key managed by DynamoDB, and you are not charged any fee for using it.
importSourceImportSourceSpecificationimport_sourceImportSourceSpecificationimportSourceImportSourceSpecificationImportSourceImportSourceSpecificationImportSourceImportSourceSpecification= no data import from the S3 bucke…#default
Default: no data import from the S3 bucket
kinesisPrecisionTimestampApproximateCreationDateTimePrecisionkinesis_precision_timestampApproximateCreationDateTimePrecisionkinesisPrecisionTimestampApproximateCreationDateTimePrecisionKinesisPrecisionTimestampApproximateCreationDateTimePrecisionKinesisPrecisionTimestampApproximateCreationDateTimePrecision= ApproximateCreationDateTimePreci…#default
Default: ApproximateCreationDateTimePrecision.MICROSECOND
kinesisStreamIStreamkinesis_streamIStreamkinesisStreamIStreamKinesisStreamIStreamKinesisStreamIStream= no Kinesis Data Stream#maxReadRequestUnitsnumbermax_read_request_unitsint | floatmaxReadRequestUnitsNumberMaxReadRequestUnitsdoubleMaxReadRequestUnits*float64= on-demand throughput is disabled#Careful if you add Global Secondary Indexes, as those will share the table's maximum on-demand throughput.
Can only be provided if billingMode is PAY_PER_REQUEST.
maxWriteRequestUnitsnumbermax_write_request_unitsint | floatmaxWriteRequestUnitsNumberMaxWriteRequestUnitsdoubleMaxWriteRequestUnits*float64= on-demand throughput is disabled#Careful if you add Global Secondary Indexes, as those will share the table's maximum on-demand throughput.
Can only be provided if billingMode is PAY_PER_REQUEST.
partitionKeyAttributepartition_keyAttributepartitionKeyAttributePartitionKeyAttributePartitionKeyAttribute= exactly one of `partitionKey` an…#If a single field forms the partition key, you can use this field. Use the partitionKeys field if the partition key is a multi-attribute key (consists of multiple fields).
default
Default: exactly one of partitionKey and partitionKeys must be specified.
pointInTimeRecoverybooleanpoint_in_time_recoveryboolpointInTimeRecoveryBooleanPointInTimeRecoveryboolPointInTimeRecovery*bool= false - point in time recovery i…deprecated#default
Default: false - point in time recovery is not enabled.
pointInTimeRecoverySpecificationPointInTimeRecoverySpecificationpoint_in_time_recovery_specificationPointInTimeRecoverySpecificationpointInTimeRecoverySpecificationPointInTimeRecoverySpecificationPointInTimeRecoverySpecificationPointInTimeRecoverySpecificationPointInTimeRecoverySpecificationPointInTimeRecoverySpecification= point in time recovery is not en…#default
Default: point in time recovery is not enabled.
readCapacitynumberread_capacityint | floatreadCapacityNumberReadCapacitydoubleReadCapacity*float64= 5#Careful if you add Global Secondary Indexes, as those will share the table's provisioned throughput.
Can only be provided if billingMode is Provisioned.
removalPolicyRemovalPolicyremoval_policyRemovalPolicyremovalPolicyRemovalPolicyRemovalPolicyRemovalPolicyRemovalPolicyRemovalPolicy= RemovalPolicy.RETAIN#replicaRemovalPolicyRemovalPolicyreplica_removal_policyRemovalPolicyreplicaRemovalPolicyRemovalPolicyReplicaRemovalPolicyRemovalPolicyReplicaRemovalPolicyRemovalPolicy= undefined - use DynamoDB Table's…#default
Default: undefined - use DynamoDB Table's removal policy
replicationRegionsstring[]replication_regionstyping.List[str]replicationRegionsList<String>ReplicationRegionsstring[]ReplicationRegions*[]*string= no replica tables are created#replicationTimeoutDurationreplication_timeoutDurationreplicationTimeoutDurationReplicationTimeoutDurationReplicationTimeoutDuration= Duration.minutes(30)#resourcePolicyPolicyDocumentresource_policyPolicyDocumentresourcePolicyPolicyDocumentResourcePolicyPolicyDocumentResourcePolicyPolicyDocument= No resource policy statement#If a single field forms the sort key, you can use this field. Use the sortKeys field if the sort key is a multi-attribute key (consists of multiple fields).
streamStreamViewTypestreamStreamViewTypestreamStreamViewTypeStreamStreamViewTypeStreamStreamViewType= streams are disabled unless `rep…#default
Default: streams are disabled unless replicationRegions is specified
tableClassTableClasstable_classTableClasstableClassTableClassTableClassTableClassTableClassTableClass= STANDARD#timeToLiveAttributestringtime_to_live_attributestrtimeToLiveAttributeStringTimeToLiveAttributestringTimeToLiveAttribute*string= TTL is disabled#waitForReplicationToFinishbooleanwait_for_replication_to_finishboolwaitForReplicationToFinishBooleanWaitForReplicationToFinishboolWaitForReplicationToFinish*bool= true#notes
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.
WARNING: 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.
If the custom resource which handles replication has a physical resource ID with the format region instead of tablename-region (this would happen if the custom resource hasn't received an event since v1.91.0), DO NOT SET this property to false without making a change to the table name. This will cause the existing replicas to be deleted.
warmThroughputWarmThroughputwarm_throughputWarmThroughputwarmThroughputWarmThroughputWarmThroughputWarmThroughputWarmThroughputWarmThroughput= warm throughput is not configure…#To enable Warm Throughput, use the TableV2 construct instead.
default
Default: warm throughput is not configured
writeCapacitynumberwrite_capacityint | floatwriteCapacityNumberWriteCapacitydoubleWriteCapacity*float64= 5#Careful if you add Global Secondary Indexes, as those will share the table's provisioned throughput.
Can only be provided if billingMode is Provisioned.