java.lang.Object
software.amazon.jsii.JsiiObject
software.constructs.Construct
All Implemented Interfaces:
IInspectable, ITaggable, software.amazon.jsii.JsiiSerializable, software.constructs.IConstruct, software.constructs.IDependable

@Generated(value="jsii-pacmak/1.97.0 (build 729de35)", date="2024-04-18T17:54:15.379Z") @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 here 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())
                 .provisionedThroughput(ProvisionedThroughputProperty.builder()
                         .readCapacityUnits(123)
                         .writeCapacityUnits(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()))
         .pointInTimeRecoverySpecification(PointInTimeRecoverySpecificationProperty.builder()
                 .pointInTimeRecoveryEnabled(false)
                 .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())
         .build();
 

See Also:
  • Field Details

    • CFN_RESOURCE_TYPE_NAME

      @Stability(Stable) public static final String 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

      @Stability(Stable) public void inspect(@NotNull TreeInspector inspector)
      Examines the CloudFormation resource and discloses attributes.

      Specified by:
      inspect in interface IInspectable
      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 class CfnResource
      Parameters:
      props - This parameter is required.
    • getAttrArn

      @Stability(Stable) @NotNull public String getAttrArn()
      The Amazon Resource Name (ARN) of the DynamoDB table, such as arn:aws:dynamodb:us-east-2:123456789012:table/myDynamoDBTable .
    • getAttrStreamArn

      @Stability(Stable) @NotNull public String getAttrStreamArn()
      The ARN of the DynamoDB stream, such as arn: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

      @Stability(Stable) @NotNull protected Map<String,Object> getCfnProperties()
      Overrides:
      getCfnProperties in class CfnResource
    • getTags

      @Stability(Stable) @NotNull public TagManager getTags()
      Tag Manager which manages the tags for this resource.
      Specified by:
      getTags in interface ITaggable
    • getKeySchema

      @Stability(Stable) @NotNull public Object getKeySchema()
      Specifies the attributes that make up the primary key for the table.
    • setKeySchema

      @Stability(Stable) public void setKeySchema(@NotNull IResolvable value)
      Specifies the attributes that make up the primary key for the table.
    • setKeySchema

      @Stability(Stable) public void setKeySchema(@NotNull List<Object> value)
      Specifies the attributes that make up the primary key for the table.
    • getAttributeDefinitions

      @Stability(Stable) @Nullable public Object getAttributeDefinitions()
      A list of attributes that describe the key schema for the table and indexes.
    • setAttributeDefinitions

      @Stability(Stable) public void setAttributeDefinitions(@Nullable IResolvable value)
      A list of attributes that describe the key schema for the table and indexes.
    • setAttributeDefinitions

      @Stability(Stable) public void setAttributeDefinitions(@Nullable List<Object> value)
      A list of attributes that describe the key schema for the table and indexes.
    • getBillingMode

      @Stability(Stable) @Nullable public String getBillingMode()
      Specify how you are charged for read and write throughput and how you manage capacity.
    • setBillingMode

      @Stability(Stable) public void setBillingMode(@Nullable String value)
      Specify how you are charged for read and write throughput and how you manage capacity.
    • getContributorInsightsSpecification

      @Stability(Stable) @Nullable public Object getContributorInsightsSpecification()
      The settings used to enable or disable CloudWatch Contributor Insights for the specified table.
    • setContributorInsightsSpecification

      @Stability(Stable) public void setContributorInsightsSpecification(@Nullable IResolvable value)
      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

      @Stability(Stable) @Nullable public Object getDeletionProtectionEnabled()
      Determines if a table is protected from deletion.
    • setDeletionProtectionEnabled

      @Stability(Stable) public void setDeletionProtectionEnabled(@Nullable Boolean value)
      Determines if a table is protected from deletion.
    • setDeletionProtectionEnabled

      @Stability(Stable) public void setDeletionProtectionEnabled(@Nullable IResolvable value)
      Determines if a table is protected from deletion.
    • getGlobalSecondaryIndexes

      @Stability(Stable) @Nullable public Object getGlobalSecondaryIndexes()
      Global secondary indexes to be created on the table.

      You can create up to 20 global secondary indexes.

    • setGlobalSecondaryIndexes

      @Stability(Stable) public void setGlobalSecondaryIndexes(@Nullable IResolvable value)
      Global secondary indexes to be created on the table.

      You can create up to 20 global secondary indexes.

    • setGlobalSecondaryIndexes

      @Stability(Stable) public void setGlobalSecondaryIndexes(@Nullable List<Object> value)
      Global secondary indexes to be created on the table.

      You can create up to 20 global secondary indexes.

    • getImportSourceSpecification

      @Stability(Stable) @Nullable public Object getImportSourceSpecification()
      Specifies the properties of data being imported from the S3 bucket source to the table.
    • setImportSourceSpecification

      @Stability(Stable) public void setImportSourceSpecification(@Nullable IResolvable value)
      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

      @Stability(Stable) @Nullable public Object getKinesisStreamSpecification()
      The Kinesis Data Streams configuration for the specified table.
    • setKinesisStreamSpecification

      @Stability(Stable) public void setKinesisStreamSpecification(@Nullable IResolvable value)
      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

      @Stability(Stable) @Nullable public Object getLocalSecondaryIndexes()
      Local secondary indexes to be created on the table.
    • setLocalSecondaryIndexes

      @Stability(Stable) public void setLocalSecondaryIndexes(@Nullable IResolvable value)
      Local secondary indexes to be created on the table.
    • setLocalSecondaryIndexes

      @Stability(Stable) public void setLocalSecondaryIndexes(@Nullable List<Object> value)
      Local secondary indexes to be created on the table.
    • getPointInTimeRecoverySpecification

      @Stability(Stable) @Nullable public Object getPointInTimeRecoverySpecification()
      The settings used to enable point in time recovery.
    • setPointInTimeRecoverySpecification

      @Stability(Stable) public void setPointInTimeRecoverySpecification(@Nullable IResolvable value)
      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

      @Stability(Stable) @Nullable public Object getProvisionedThroughput()
      Throughput for the specified table, which consists of values for ReadCapacityUnits and WriteCapacityUnits .
    • setProvisionedThroughput

      @Stability(Stable) public void setProvisionedThroughput(@Nullable IResolvable value)
      Throughput for the specified table, which consists of values for ReadCapacityUnits and WriteCapacityUnits .
    • setProvisionedThroughput

      @Stability(Stable) public void setProvisionedThroughput(@Nullable CfnTable.ProvisionedThroughputProperty value)
      Throughput for the specified table, which consists of values for ReadCapacityUnits and WriteCapacityUnits .
    • getResourcePolicy

      @Stability(Stable) @Nullable public Object getResourcePolicy()
      A resource-based policy document that contains permissions to add to the specified table.
    • setResourcePolicy

      @Stability(Stable) public void setResourcePolicy(@Nullable IResolvable value)
      A resource-based policy document that contains permissions to add to the specified table.
    • setResourcePolicy

      @Stability(Stable) public void setResourcePolicy(@Nullable CfnTable.ResourcePolicyProperty value)
      A resource-based policy document that contains permissions to add to the specified table.
    • getSseSpecification

      @Stability(Stable) @Nullable public Object getSseSpecification()
      Specifies the settings to enable server-side encryption.
    • setSseSpecification

      @Stability(Stable) public void setSseSpecification(@Nullable IResolvable value)
      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

      @Stability(Stable) @Nullable public Object getStreamSpecification()
      The settings for the DynamoDB table stream, which capture changes to items stored in the table.
    • setStreamSpecification

      @Stability(Stable) public void setStreamSpecification(@Nullable IResolvable value)
      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

      @Stability(Stable) @Nullable public String getTableClass()
      The table class of the new table.
    • setTableClass

      @Stability(Stable) public void setTableClass(@Nullable String value)
      The table class of the new table.
    • getTableName

      @Stability(Stable) @Nullable public String getTableName()
      A name for the table.
    • setTableName

      @Stability(Stable) public void setTableName(@Nullable String value)
      A name for the table.
    • getTagsRaw

      @Stability(Stable) @Nullable public List<CfnTag> getTagsRaw()
      An array of key-value pairs to apply to this resource.
    • setTagsRaw

      @Stability(Stable) public void setTagsRaw(@Nullable List<CfnTag> value)
      An array of key-value pairs to apply to this resource.
    • getTimeToLiveSpecification

      @Stability(Stable) @Nullable public Object getTimeToLiveSpecification()
      Specifies the Time to Live (TTL) settings for the table.
    • setTimeToLiveSpecification

      @Stability(Stable) public void setTimeToLiveSpecification(@Nullable IResolvable value)
      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.