Class CfnTable
java.lang.Object
software.amazon.jsii.JsiiObject
software.constructs.Construct
software.amazon.awscdk.CfnElement
software.amazon.awscdk.CfnRefElement
software.amazon.awscdk.CfnResource
software.amazon.awscdk.services.dynamodb.CfnTable
- All Implemented Interfaces:
IInspectable
,ITaggable
,software.amazon.jsii.JsiiSerializable
,software.constructs.IConstruct
,software.constructs.IDependable
@Generated(value="jsii-pacmak/1.106.0 (build e852934)",
date="2025-02-06T22:15:52.719Z")
@Stability(Stable)
public class CfnTable
extends CfnResource
implements IInspectable, ITaggable
The
AWS::DynamoDB::Table
resource creates a DynamoDB table. For more information, see CreateTable in the Amazon DynamoDB API Reference .
You should be aware of the following behaviors when working with DynamoDB tables:
- AWS CloudFormation typically creates DynamoDB tables in parallel. However, if your template includes multiple DynamoDB tables with indexes, you must declare dependencies so that the tables are created sequentially. Amazon DynamoDB limits the number of tables with secondary indexes that are in the creating state. If you create multiple tables with indexes at the same time, DynamoDB returns an error and the stack operation fails. For an example, see DynamoDB Table with a DependsOn Attribute .
Our guidance is to use the latest schema documented for your AWS CloudFormation templates. This schema supports the provisioning of all table settings below. When using this schema in your AWS CloudFormation templates, please ensure that your Identity and Access Management ( IAM ) policies are updated with appropriate permissions to allow for the authorization of these setting changes.
Example:
// The code below shows an example of how to instantiate this type. // The values are placeholders you should change. import software.amazon.awscdk.services.dynamodb.*; Object policyDocument; CfnTable cfnTable = CfnTable.Builder.create(this, "MyCfnTable") .keySchema(List.of(KeySchemaProperty.builder() .attributeName("attributeName") .keyType("keyType") .build())) // the properties below are optional .attributeDefinitions(List.of(AttributeDefinitionProperty.builder() .attributeName("attributeName") .attributeType("attributeType") .build())) .billingMode("billingMode") .contributorInsightsSpecification(ContributorInsightsSpecificationProperty.builder() .enabled(false) .build()) .deletionProtectionEnabled(false) .globalSecondaryIndexes(List.of(GlobalSecondaryIndexProperty.builder() .indexName("indexName") .keySchema(List.of(KeySchemaProperty.builder() .attributeName("attributeName") .keyType("keyType") .build())) .projection(ProjectionProperty.builder() .nonKeyAttributes(List.of("nonKeyAttributes")) .projectionType("projectionType") .build()) // the properties below are optional .contributorInsightsSpecification(ContributorInsightsSpecificationProperty.builder() .enabled(false) .build()) .onDemandThroughput(OnDemandThroughputProperty.builder() .maxReadRequestUnits(123) .maxWriteRequestUnits(123) .build()) .provisionedThroughput(ProvisionedThroughputProperty.builder() .readCapacityUnits(123) .writeCapacityUnits(123) .build()) .warmThroughput(WarmThroughputProperty.builder() .readUnitsPerSecond(123) .writeUnitsPerSecond(123) .build()) .build())) .importSourceSpecification(ImportSourceSpecificationProperty.builder() .inputFormat("inputFormat") .s3BucketSource(S3BucketSourceProperty.builder() .s3Bucket("s3Bucket") // the properties below are optional .s3BucketOwner("s3BucketOwner") .s3KeyPrefix("s3KeyPrefix") .build()) // the properties below are optional .inputCompressionType("inputCompressionType") .inputFormatOptions(InputFormatOptionsProperty.builder() .csv(CsvProperty.builder() .delimiter("delimiter") .headerList(List.of("headerList")) .build()) .build()) .build()) .kinesisStreamSpecification(KinesisStreamSpecificationProperty.builder() .streamArn("streamArn") // the properties below are optional .approximateCreationDateTimePrecision("approximateCreationDateTimePrecision") .build()) .localSecondaryIndexes(List.of(LocalSecondaryIndexProperty.builder() .indexName("indexName") .keySchema(List.of(KeySchemaProperty.builder() .attributeName("attributeName") .keyType("keyType") .build())) .projection(ProjectionProperty.builder() .nonKeyAttributes(List.of("nonKeyAttributes")) .projectionType("projectionType") .build()) .build())) .onDemandThroughput(OnDemandThroughputProperty.builder() .maxReadRequestUnits(123) .maxWriteRequestUnits(123) .build()) .pointInTimeRecoverySpecification(PointInTimeRecoverySpecificationProperty.builder() .pointInTimeRecoveryEnabled(false) .recoveryPeriodInDays(123) .build()) .provisionedThroughput(ProvisionedThroughputProperty.builder() .readCapacityUnits(123) .writeCapacityUnits(123) .build()) .resourcePolicy(ResourcePolicyProperty.builder() .policyDocument(policyDocument) .build()) .sseSpecification(SSESpecificationProperty.builder() .sseEnabled(false) // the properties below are optional .kmsMasterKeyId("kmsMasterKeyId") .sseType("sseType") .build()) .streamSpecification(StreamSpecificationProperty.builder() .streamViewType("streamViewType") // the properties below are optional .resourcePolicy(ResourcePolicyProperty.builder() .policyDocument(policyDocument) .build()) .build()) .tableClass("tableClass") .tableName("tableName") .tags(List.of(CfnTag.builder() .key("key") .value("value") .build())) .timeToLiveSpecification(TimeToLiveSpecificationProperty.builder() .enabled(false) // the properties below are optional .attributeName("attributeName") .build()) .warmThroughput(WarmThroughputProperty.builder() .readUnitsPerSecond(123) .writeUnitsPerSecond(123) .build()) .build();
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interface
Represents an attribute for describing the schema for the table and indexes.static final class
A fluent builder forCfnTable
.static interface
The settings used to enable or disable CloudWatch Contributor Insights.static interface
The options for imported source files in CSV format.static interface
Represents the properties of a global secondary index.static interface
Specifies the properties of data being imported from the S3 bucket source to the table.static interface
The format options for the data that was imported into the target table.static interface
Represents a single element of a key schema.static interface
The Kinesis Data Streams configuration for the specified table.static interface
Represents the properties of a local secondary index.static interface
Sets the maximum number of read and write units for the specified on-demand table.static interface
The settings used to enable point in time recovery.static interface
Represents attributes that are copied (projected) from the table into an index.static interface
Throughput for the specified table, which consists of values forReadCapacityUnits
andWriteCapacityUnits
.static interface
Creates or updates a resource-based policy document that contains the permissions for DynamoDB resources, such as a table, its indexes, and stream.static interface
The S3 bucket that is being imported from.static interface
Represents the settings used to enable server-side encryption.static interface
Represents the DynamoDB Streams configuration for a table in DynamoDB.static interface
Represents the settings used to enable or disable Time to Live (TTL) for the specified table.static interface
Provides visibility into the number of read and write operations your table or secondary index can instantaneously support.Nested classes/interfaces inherited from class software.amazon.jsii.JsiiObject
software.amazon.jsii.JsiiObject.InitializationMode
Nested classes/interfaces inherited from interface software.constructs.IConstruct
software.constructs.IConstruct.Jsii$Default
Nested classes/interfaces inherited from interface software.amazon.awscdk.IInspectable
IInspectable.Jsii$Default, IInspectable.Jsii$Proxy
Nested classes/interfaces inherited from interface software.amazon.awscdk.ITaggable
ITaggable.Jsii$Default, ITaggable.Jsii$Proxy
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
The CloudFormation resource type name for this resource class. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
CfnTable
(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) protected
CfnTable
(software.amazon.jsii.JsiiObjectRef objRef) CfnTable
(software.constructs.Construct scope, String id, CfnTableProps props) -
Method Summary
Modifier and TypeMethodDescriptionThe Amazon Resource Name (ARN) of the DynamoDB table, such asarn:aws:dynamodb:us-east-2:123456789012:table/myDynamoDBTable
.A list of attributes that describe the key schema for the table and indexes.The ARN of the DynamoDB stream, such asarn:aws:dynamodb:us-east-1:123456789012:table/testddbstack-myDynamoDBTable-012A1SL7SMP5Q/stream/2015-11-30T20:10:00.000
.Specify how you are charged for read and write throughput and how you manage capacity.The settings used to enable or disable CloudWatch Contributor Insights for the specified table.Determines if a table is protected from deletion.Global secondary indexes to be created on the table.Specifies the properties of data being imported from the S3 bucket source to the" table.Specifies the attributes that make up the primary key for the table.The Kinesis Data Streams configuration for the specified table.Local secondary indexes to be created on the table.Sets the maximum number of read and write units for the specified on-demand table.The settings used to enable point in time recovery.Throughput for the specified table, which consists of values forReadCapacityUnits
andWriteCapacityUnits
.A resource-based policy document that contains permissions to add to the specified table.Specifies the settings to enable server-side encryption.The settings for the DynamoDB table stream, which capture changes to items stored in the table.The table class of the new table.A name for the table.getTags()
Tag Manager which manages the tags for this resource.An array of key-value pairs to apply to this resource.Specifies the Time to Live (TTL) settings for the table.Represents the warm throughput (in read units per second and write units per second) for creating a table.void
inspect
(TreeInspector inspector) Examines the CloudFormation resource and discloses attributes.renderProperties
(Map<String, Object> props) void
setAttributeDefinitions
(List<Object> value) A list of attributes that describe the key schema for the table and indexes.void
A list of attributes that describe the key schema for the table and indexes.void
setBillingMode
(String value) Specify how you are charged for read and write throughput and how you manage capacity.void
The settings used to enable or disable CloudWatch Contributor Insights for the specified table.void
The settings used to enable or disable CloudWatch Contributor Insights for the specified table.void
Determines if a table is protected from deletion.void
Determines if a table is protected from deletion.void
setGlobalSecondaryIndexes
(List<Object> value) Global secondary indexes to be created on the table.void
Global secondary indexes to be created on the table.void
Specifies the properties of data being imported from the S3 bucket source to the" table.void
Specifies the properties of data being imported from the S3 bucket source to the" table.void
setKeySchema
(List<Object> value) Specifies the attributes that make up the primary key for the table.void
setKeySchema
(IResolvable value) Specifies the attributes that make up the primary key for the table.void
The Kinesis Data Streams configuration for the specified table.void
The Kinesis Data Streams configuration for the specified table.void
setLocalSecondaryIndexes
(List<Object> value) Local secondary indexes to be created on the table.void
Local secondary indexes to be created on the table.void
setOnDemandThroughput
(IResolvable value) Sets the maximum number of read and write units for the specified on-demand table.void
Sets the maximum number of read and write units for the specified on-demand table.void
The settings used to enable point in time recovery.void
The settings used to enable point in time recovery.void
Throughput for the specified table, which consists of values forReadCapacityUnits
andWriteCapacityUnits
.void
Throughput for the specified table, which consists of values forReadCapacityUnits
andWriteCapacityUnits
.void
setResourcePolicy
(IResolvable value) A resource-based policy document that contains permissions to add to the specified table.void
A resource-based policy document that contains permissions to add to the specified table.void
setSseSpecification
(IResolvable value) Specifies the settings to enable server-side encryption.void
Specifies the settings to enable server-side encryption.void
The settings for the DynamoDB table stream, which capture changes to items stored in the table.void
The settings for the DynamoDB table stream, which capture changes to items stored in the table.void
setTableClass
(String value) The table class of the new table.void
setTableName
(String value) A name for the table.void
setTagsRaw
(List<CfnTag> value) An array of key-value pairs to apply to this resource.void
Specifies the Time to Live (TTL) settings for the table.void
Specifies the Time to Live (TTL) settings for the table.void
setWarmThroughput
(IResolvable value) Represents the warm throughput (in read units per second and write units per second) for creating a table.void
Represents the warm throughput (in read units per second and write units per second) for creating a table.Methods inherited from class software.amazon.awscdk.CfnResource
addDeletionOverride, addDependency, addDependsOn, addMetadata, addOverride, addPropertyDeletionOverride, addPropertyOverride, applyRemovalPolicy, applyRemovalPolicy, applyRemovalPolicy, getAtt, getAtt, getCfnOptions, getCfnResourceType, getMetadata, getUpdatedProperites, getUpdatedProperties, isCfnResource, obtainDependencies, obtainResourceDependencies, removeDependency, replaceDependency, shouldSynthesize, toString, validateProperties
Methods inherited from class software.amazon.awscdk.CfnRefElement
getRef
Methods inherited from class software.amazon.awscdk.CfnElement
getCreationStack, getLogicalId, getStack, isCfnElement, overrideLogicalId
Methods inherited from class software.constructs.Construct
getNode, isConstruct
Methods inherited from class software.amazon.jsii.JsiiObject
jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSet
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Field Details
-
CFN_RESOURCE_TYPE_NAME
The CloudFormation resource type name for this resource class.
-
-
Constructor Details
-
CfnTable
protected CfnTable(software.amazon.jsii.JsiiObjectRef objRef) -
CfnTable
protected CfnTable(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) -
CfnTable
@Stability(Stable) public CfnTable(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull CfnTableProps props) - Parameters:
scope
- Scope in which this resource is defined. This parameter is required.id
- Construct identifier for this resource (unique in its scope). This parameter is required.props
- Resource properties. This parameter is required.
-
-
Method Details
-
inspect
Examines the CloudFormation resource and discloses attributes.- Specified by:
inspect
in interfaceIInspectable
- Parameters:
inspector
- tree inspector to collect and process attributes. This parameter is required.
-
renderProperties
@Stability(Stable) @NotNull protected Map<String,Object> renderProperties(@NotNull Map<String, Object> props) - Overrides:
renderProperties
in classCfnResource
- Parameters:
props
- This parameter is required.
-
getAttrArn
The Amazon Resource Name (ARN) of the DynamoDB table, such asarn:aws:dynamodb:us-east-2:123456789012:table/myDynamoDBTable
. -
getAttrStreamArn
The ARN of the DynamoDB stream, such asarn:aws:dynamodb:us-east-1:123456789012:table/testddbstack-myDynamoDBTable-012A1SL7SMP5Q/stream/2015-11-30T20:10:00.000
.You must specify the
StreamSpecification
property to use this attribute. -
getCfnProperties
- Overrides:
getCfnProperties
in classCfnResource
-
getTags
Tag Manager which manages the tags for this resource. -
getKeySchema
Specifies the attributes that make up the primary key for the table. -
setKeySchema
Specifies the attributes that make up the primary key for the table. -
setKeySchema
Specifies the attributes that make up the primary key for the table. -
getAttributeDefinitions
A list of attributes that describe the key schema for the table and indexes. -
setAttributeDefinitions
A list of attributes that describe the key schema for the table and indexes. -
setAttributeDefinitions
A list of attributes that describe the key schema for the table and indexes. -
getBillingMode
Specify how you are charged for read and write throughput and how you manage capacity. -
setBillingMode
Specify how you are charged for read and write throughput and how you manage capacity. -
getContributorInsightsSpecification
The settings used to enable or disable CloudWatch Contributor Insights for the specified table. -
setContributorInsightsSpecification
The settings used to enable or disable CloudWatch Contributor Insights for the specified table. -
setContributorInsightsSpecification
@Stability(Stable) public void setContributorInsightsSpecification(@Nullable CfnTable.ContributorInsightsSpecificationProperty value) The settings used to enable or disable CloudWatch Contributor Insights for the specified table. -
getDeletionProtectionEnabled
Determines if a table is protected from deletion. -
setDeletionProtectionEnabled
Determines if a table is protected from deletion. -
setDeletionProtectionEnabled
Determines if a table is protected from deletion. -
getGlobalSecondaryIndexes
Global secondary indexes to be created on the table.You can create up to 20 global secondary indexes.
-
setGlobalSecondaryIndexes
Global secondary indexes to be created on the table.You can create up to 20 global secondary indexes.
-
setGlobalSecondaryIndexes
Global secondary indexes to be created on the table.You can create up to 20 global secondary indexes.
-
getImportSourceSpecification
Specifies the properties of data being imported from the S3 bucket source to the" table. -
setImportSourceSpecification
Specifies the properties of data being imported from the S3 bucket source to the" table. -
setImportSourceSpecification
@Stability(Stable) public void setImportSourceSpecification(@Nullable CfnTable.ImportSourceSpecificationProperty value) Specifies the properties of data being imported from the S3 bucket source to the" table. -
getKinesisStreamSpecification
The Kinesis Data Streams configuration for the specified table. -
setKinesisStreamSpecification
The Kinesis Data Streams configuration for the specified table. -
setKinesisStreamSpecification
@Stability(Stable) public void setKinesisStreamSpecification(@Nullable CfnTable.KinesisStreamSpecificationProperty value) The Kinesis Data Streams configuration for the specified table. -
getLocalSecondaryIndexes
Local secondary indexes to be created on the table. -
setLocalSecondaryIndexes
Local secondary indexes to be created on the table. -
setLocalSecondaryIndexes
Local secondary indexes to be created on the table. -
getOnDemandThroughput
Sets the maximum number of read and write units for the specified on-demand table. -
setOnDemandThroughput
Sets the maximum number of read and write units for the specified on-demand table. -
setOnDemandThroughput
@Stability(Stable) public void setOnDemandThroughput(@Nullable CfnTable.OnDemandThroughputProperty value) Sets the maximum number of read and write units for the specified on-demand table. -
getPointInTimeRecoverySpecification
The settings used to enable point in time recovery. -
setPointInTimeRecoverySpecification
The settings used to enable point in time recovery. -
setPointInTimeRecoverySpecification
@Stability(Stable) public void setPointInTimeRecoverySpecification(@Nullable CfnTable.PointInTimeRecoverySpecificationProperty value) The settings used to enable point in time recovery. -
getProvisionedThroughput
Throughput for the specified table, which consists of values forReadCapacityUnits
andWriteCapacityUnits
. -
setProvisionedThroughput
Throughput for the specified table, which consists of values forReadCapacityUnits
andWriteCapacityUnits
. -
setProvisionedThroughput
@Stability(Stable) public void setProvisionedThroughput(@Nullable CfnTable.ProvisionedThroughputProperty value) Throughput for the specified table, which consists of values forReadCapacityUnits
andWriteCapacityUnits
. -
getResourcePolicy
A resource-based policy document that contains permissions to add to the specified table. -
setResourcePolicy
A resource-based policy document that contains permissions to add to the specified table. -
setResourcePolicy
A resource-based policy document that contains permissions to add to the specified table. -
getSseSpecification
Specifies the settings to enable server-side encryption. -
setSseSpecification
Specifies the settings to enable server-side encryption. -
setSseSpecification
@Stability(Stable) public void setSseSpecification(@Nullable CfnTable.SSESpecificationProperty value) Specifies the settings to enable server-side encryption. -
getStreamSpecification
The settings for the DynamoDB table stream, which capture changes to items stored in the table. -
setStreamSpecification
The settings for the DynamoDB table stream, which capture changes to items stored in the table. -
setStreamSpecification
@Stability(Stable) public void setStreamSpecification(@Nullable CfnTable.StreamSpecificationProperty value) The settings for the DynamoDB table stream, which capture changes to items stored in the table. -
getTableClass
The table class of the new table. -
setTableClass
The table class of the new table. -
getTableName
A name for the table. -
setTableName
A name for the table. -
getTagsRaw
An array of key-value pairs to apply to this resource. -
setTagsRaw
An array of key-value pairs to apply to this resource. -
getTimeToLiveSpecification
Specifies the Time to Live (TTL) settings for the table. -
setTimeToLiveSpecification
Specifies the Time to Live (TTL) settings for the table. -
setTimeToLiveSpecification
@Stability(Stable) public void setTimeToLiveSpecification(@Nullable CfnTable.TimeToLiveSpecificationProperty value) Specifies the Time to Live (TTL) settings for the table. -
getWarmThroughput
Represents the warm throughput (in read units per second and write units per second) for creating a table. -
setWarmThroughput
Represents the warm throughput (in read units per second and write units per second) for creating a table. -
setWarmThroughput
Represents the warm throughput (in read units per second and write units per second) for creating a table.
-