CfnTableProps Struct
Properties for defining a CfnTable.
Example
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_dynamodb as dynamodb } from 'aws-cdk-lib';
declare const policyDocument: any;
const cfnTableProps: dynamodb.CfnTableProps = {
keySchema: [{
attributeName: 'attributeName',
keyType: 'keyType',
}],
// the properties below are optional
attributeDefinitions: [{
attributeName: 'attributeName',
attributeType: 'attributeType',
}],
billingMode: 'billingMode',
contributorInsightsSpecification: {
enabled: false,
// the properties below are optional
mode: 'mode',
},
deletionProtectionEnabled: false,
globalSecondaryIndexes: [{
indexName: 'indexName',
keySchema: [{
attributeName: 'attributeName',
keyType: 'keyType',
}],
projection: {
nonKeyAttributes: ['nonKeyAttributes'],
projectionType: 'projectionType',
},
// the properties below are optional
contributorInsightsSpecification: {
enabled: false,
// the properties below are optional
mode: 'mode',
},
onDemandThroughput: {
maxReadRequestUnits: 123,
maxWriteRequestUnits: 123,
},
provisionedThroughput: {
readCapacityUnits: 123,
writeCapacityUnits: 123,
},
warmThroughput: {
readUnitsPerSecond: 123,
writeUnitsPerSecond: 123,
},
}],
importSourceSpecification: {
inputFormat: 'inputFormat',
s3BucketSource: {
s3Bucket: 's3Bucket',
// the properties below are optional
s3BucketOwner: 's3BucketOwner',
s3KeyPrefix: 's3KeyPrefix',
},
// the properties below are optional
inputCompressionType: 'inputCompressionType',
inputFormatOptions: {
csv: {
delimiter: 'delimiter',
headerList: ['headerList'],
},
},
},
kinesisStreamSpecification: {
streamArn: 'streamArn',
// the properties below are optional
approximateCreationDateTimePrecision: 'approximateCreationDateTimePrecision',
},
localSecondaryIndexes: [{
indexName: 'indexName',
keySchema: [{
attributeName: 'attributeName',
keyType: 'keyType',
}],
projection: {
nonKeyAttributes: ['nonKeyAttributes'],
projectionType: 'projectionType',
},
}],
onDemandThroughput: {
maxReadRequestUnits: 123,
maxWriteRequestUnits: 123,
},
pointInTimeRecoverySpecification: {
pointInTimeRecoveryEnabled: false,
recoveryPeriodInDays: 123,
},
provisionedThroughput: {
readCapacityUnits: 123,
writeCapacityUnits: 123,
},
resourcePolicy: {
policyDocument: policyDocument,
},
sseSpecification: {
sseEnabled: false,
// the properties below are optional
kmsMasterKeyId: 'kmsMasterKeyId',
sseType: 'sseType',
},
streamSpecification: {
streamViewType: 'streamViewType',
// the properties below are optional
resourcePolicy: {
policyDocument: policyDocument,
},
tags: [{
key: 'key',
value: 'value',
}],
},
tableClass: 'tableClass',
tableName: 'tableName',
tags: [{
key: 'key',
value: 'value',
}],
timeToLiveSpecification: {
enabled: false,
// the properties below are optional
attributeName: 'attributeName',
},
vectorIndexes: [{
dimensions: 123,
distanceFunction: 'distanceFunction',
indexName: 'indexName',
projection: {
nonKeyAttributes: ['nonKeyAttributes'],
projectionType: 'projectionType',
},
vectorAttribute: {
attributeName: 'attributeName',
},
// the properties below are optional
searchSchema: [{
attributeName: 'attributeName',
searchSchemaElementType: 'searchSchemaElementType',
}],
}],
warmThroughput: {
readUnitsPerSecond: 123,
writeUnitsPerSecond: 123,
},
};
Properties
attributeDefinitionsIResolvable | IResolvable | CfnTable.AttributeDefinitionProperty[]attribute_definitionstyping.Union[IResolvable, typing.List[typing.Union[IResolvable, AttributeDefinitionProperty]]]attributeDefinitionsIResolvableAttributeDefinitionsIResolvableAttributeDefinitionsinterface{}#notes
This property is required to create a DynamoDB table.
Update requires: Some interruptions . Replacement if you edit an existing AttributeDefinition.
notes
Valid values include:
PAY_PER_REQUEST- We recommend usingPAY_PER_REQUESTfor most DynamoDB workloads.PAY_PER_REQUESTsets the billing mode to On-demand capacity mode .PROVISIONED- We recommend usingPROVISIONEDfor steady workloads with predictable growth where capacity requirements can be reliably forecasted.PROVISIONEDsets the billing mode to Provisioned capacity mode .
If not specified, the default is PROVISIONED .
contributorInsightsSpecificationIResolvable | CfnTable.ContributorInsightsSpecificationPropertycontributor_insights_specificationtyping.Union[IResolvable, ContributorInsightsSpecificationProperty]contributorInsightsSpecificationIResolvableContributorInsightsSpecificationIResolvableContributorInsightsSpecificationinterface{}#deletionProtectionEnabledboolean | IResolvabledeletion_protection_enabledtyping.Union[bool, IResolvable]deletionProtectionEnabledBooleanDeletionProtectionEnabledboolDeletionProtectionEnabledinterface{}#notes
When enabled, the table cannot be deleted by any user or process. This setting is disabled by default. For more information, see Using deletion protection in the Amazon DynamoDB Developer Guide .
globalSecondaryIndexesIResolvable | IResolvable | CfnTable.GlobalSecondaryIndexProperty[]global_secondary_indexestyping.Union[IResolvable, typing.List[typing.Union[IResolvable, GlobalSecondaryIndexProperty]]]globalSecondaryIndexesIResolvableGlobalSecondaryIndexesIResolvableGlobalSecondaryIndexesinterface{}#notes
If you update a table to include a new global secondary index, AWS CloudFormation initiates the index creation and then proceeds with the stack update. AWS CloudFormation doesn't wait for the index to complete creation because the backfilling phase can take a long time, depending on the size of the table. You can't use the index or update the table until the index's status is
ACTIVE. You can track its status by using the DynamoDB DescribeTable command.If you add or delete an index during an update, we recommend that you don't update any other resources. If your stack fails to update and is rolled back while adding a new index, you must manually delete the index.
Updates are not supported. The following are exceptions:
- If you update either the contributor insights specification or the provisioned throughput values of global secondary indexes, you can update the table without interruption.
- You can delete or add one global secondary index without interruption. If you do both in the same update (for example, by changing the index's logical ID), the update fails.
importSourceSpecificationIResolvable | CfnTable.ImportSourceSpecificationPropertyimport_source_specificationtyping.Union[IResolvable, ImportSourceSpecificationProperty]importSourceSpecificationIResolvableImportSourceSpecificationIResolvableImportSourceSpecificationinterface{}#notes
If you specify the
ImportSourceSpecificationproperty, and also specify either theStreamSpecification, theTableClassproperty, theDeletionProtectionEnabledproperty, or theWarmThroughputproperty, the IAM entity creating/updating stack must haveUpdateTablepermission.
keySchemaIResolvable | IResolvable | CfnTable.KeySchemaProperty[]key_schematyping.Union[IResolvable, typing.List[typing.Union[IResolvable, KeySchemaProperty]]]keySchemaIResolvableKeySchemaIResolvableKeySchemainterface{}required#The attributes in the KeySchema property must also be defined in the AttributeDefinitions property.
kinesisStreamSpecificationIResolvable | CfnTable.KinesisStreamSpecificationPropertykinesis_stream_specificationtyping.Union[IResolvable, KinesisStreamSpecificationProperty]kinesisStreamSpecificationIResolvableKinesisStreamSpecificationIResolvableKinesisStreamSpecificationinterface{}#localSecondaryIndexesIResolvable | IResolvable | CfnTable.LocalSecondaryIndexProperty[]local_secondary_indexestyping.Union[IResolvable, typing.List[typing.Union[IResolvable, LocalSecondaryIndexProperty]]]localSecondaryIndexesIResolvableLocalSecondaryIndexesIResolvableLocalSecondaryIndexesinterface{}#You can create up to 5 local secondary indexes. Each index is scoped to a given hash key value. The size of each hash key can be up to 10 gigabytes.
onDemandThroughputIResolvable | CfnTable.OnDemandThroughputPropertyon_demand_throughputtyping.Union[IResolvable, OnDemandThroughputProperty]onDemandThroughputIResolvableOnDemandThroughputIResolvableOnDemandThroughputinterface{}#If you use this property, you must specify MaxReadRequestUnits , MaxWriteRequestUnits , or both.
pointInTimeRecoverySpecificationIResolvable | CfnTable.PointInTimeRecoverySpecificationPropertypoint_in_time_recovery_specificationtyping.Union[IResolvable, PointInTimeRecoverySpecificationProperty]pointInTimeRecoverySpecificationIResolvablePointInTimeRecoverySpecificationIResolvablePointInTimeRecoverySpecificationinterface{}#provisionedThroughputIResolvable | CfnTable.ProvisionedThroughputPropertyprovisioned_throughputtyping.Union[IResolvable, ProvisionedThroughputProperty]provisionedThroughputIResolvableProvisionedThroughputIResolvableProvisionedThroughputinterface{}#notes
For more information about the contents of a provisioned throughput structure, see Amazon DynamoDB Table ProvisionedThroughput .
If you set BillingMode as PROVISIONED , you must specify this property. If you set BillingMode as PAY_PER_REQUEST , you cannot specify this property.
resourcePolicyIResolvable | CfnTable.ResourcePolicyPropertyresource_policytyping.Union[IResolvable, ResourcePolicyProperty]resourcePolicyIResolvableResourcePolicyIResolvableResourcePolicyinterface{}#notes
When you attach a resource-based policy while creating a table, the policy application is strongly consistent .
The maximum size supported for a resource-based policy document is 20 KB. DynamoDB counts whitespaces when calculating the size of a policy against this limit. For a full list of all considerations that apply for resource-based policies, see Resource-based policy considerations .
You need to specify the
CreateTableandPutResourcePolicyIAM actions for authorizing a user to create a table with a resource-based policy.
sseSpecificationIResolvable | CfnTable.SSESpecificationPropertysse_specificationtyping.Union[IResolvable, SSESpecificationProperty]sseSpecificationIResolvableSseSpecificationIResolvableSseSpecificationinterface{}#streamSpecificationIResolvable | CfnTable.StreamSpecificationPropertystream_specificationtyping.Union[IResolvable, StreamSpecificationProperty]streamSpecificationIResolvableStreamSpecificationIResolvableStreamSpecificationinterface{}#Including this property in your AWS CloudFormation template automatically enables streaming.
Valid values are STANDARD and STANDARD_INFREQUENT_ACCESS .
notes
If you don't specify a name, AWS CloudFormation generates a unique physical ID and uses that ID for the table name. For more information, see Name Type .
If you specify a name, you cannot perform updates that require replacement of this resource. You can perform updates that require no or some interruption. If you must replace the resource, specify a new name.
For more information, see Tag .
timeToLiveSpecificationIResolvable | CfnTable.TimeToLiveSpecificationPropertytime_to_live_specificationtyping.Union[IResolvable, TimeToLiveSpecificationProperty]timeToLiveSpecificationIResolvableTimeToLiveSpecificationIResolvableTimeToLiveSpecificationinterface{}#For detailed information about the limits in DynamoDB, see Limits in Amazon DynamoDB in the Amazon DynamoDB Developer Guide.
vectorIndexesIResolvable | IResolvable | CfnTable.VectorIndexProperty[]vector_indexestyping.Union[IResolvable, typing.List[typing.Union[IResolvable, VectorIndexProperty]]]vectorIndexesIResolvableVectorIndexesIResolvableVectorIndexesinterface{}#warmThroughputIResolvable | CfnTable.WarmThroughputPropertywarm_throughputtyping.Union[IResolvable, WarmThroughputProperty]warmThroughputIResolvableWarmThroughputIResolvableWarmThroughputinterface{}#