@Generated(value="jsii-pacmak/1.73.0 (build 6faeda3)", date="2023-01-25T18:29:06.062Z") public class CfnTable extends CfnResource implements IInspectable
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:
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.*; 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()) .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") .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()) .sseSpecification(SSESpecificationProperty.builder() .sseEnabled(false) // the properties below are optional .kmsMasterKeyId("kmsMasterKeyId") .sseType("sseType") .build()) .streamSpecification(StreamSpecificationProperty.builder() .streamViewType("streamViewType") .build()) .tableClass("tableClass") .tableName("tableName") .tags(List.of(CfnTag.builder() .key("key") .value("value") .build())) .timeToLiveSpecification(TimeToLiveSpecificationProperty.builder() .attributeName("attributeName") .enabled(false) .build()) .build();
Modifier and Type | Class and Description |
---|---|
static interface |
CfnTable.AttributeDefinitionProperty
Represents an attribute for describing the key schema for the table and indexes.
|
static class |
CfnTable.Builder
A fluent builder for
CfnTable . |
static interface |
CfnTable.ContributorInsightsSpecificationProperty
The settings used to enable or disable CloudWatch Contributor Insights.
|
static interface |
CfnTable.CsvProperty
The options for imported source files in CSV format.
|
static interface |
CfnTable.GlobalSecondaryIndexProperty
Represents the properties of a global secondary index.
|
static interface |
CfnTable.ImportSourceSpecificationProperty
Specifies the properties of data being imported from the S3 bucket source to the table.
|
static interface |
CfnTable.InputFormatOptionsProperty
The format options for the data that was imported into the target table.
|
static interface |
CfnTable.KeySchemaProperty
Represents *a single element* of a key schema.
|
static interface |
CfnTable.KinesisStreamSpecificationProperty
The Kinesis Data Streams configuration for the specified table.
|
static interface |
CfnTable.LocalSecondaryIndexProperty
Represents the properties of a local secondary index.
|
static interface |
CfnTable.PointInTimeRecoverySpecificationProperty
The settings used to enable point in time recovery.
|
static interface |
CfnTable.ProjectionProperty
Represents attributes that are copied (projected) from the table into an index.
|
static interface |
CfnTable.ProvisionedThroughputProperty
Throughput for the specified table, which consists of values for `ReadCapacityUnits` and `WriteCapacityUnits` .
|
static interface |
CfnTable.S3BucketSourceProperty
The S3 bucket that is being imported from.
|
static interface |
CfnTable.SSESpecificationProperty
Represents the settings used to enable server-side encryption.
|
static interface |
CfnTable.StreamSpecificationProperty
Represents the DynamoDB Streams configuration for a table in DynamoDB.
|
static interface |
CfnTable.TimeToLiveSpecificationProperty
Represents the settings used to enable or disable Time to Live (TTL) for the specified table.
|
IInspectable.Jsii$Default, IInspectable.Jsii$Proxy
IConstruct.Jsii$Default
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
CFN_RESOURCE_TYPE_NAME
The CloudFormation resource type name for this resource class.
|
Modifier | Constructor and Description |
---|---|
|
CfnTable(Construct scope,
java.lang.String id,
CfnTableProps props)
Create a new `AWS::DynamoDB::Table`.
|
protected |
CfnTable(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) |
protected |
CfnTable(software.amazon.jsii.JsiiObjectRef objRef) |
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getAttrArn()
The Amazon Resource Name (ARN) of the DynamoDB table, such as `arn:aws:dynamodb:us-east-2:123456789012:table/myDynamoDBTable` .
|
java.lang.Object |
getAttributeDefinitions()
A list of attributes that describe the key schema for the table and indexes.
|
java.lang.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` .
|
java.lang.String |
getBillingMode()
Specify how you are charged for read and write throughput and how you manage capacity.
|
protected java.util.Map<java.lang.String,java.lang.Object> |
getCfnProperties() |
java.lang.Object |
getContributorInsightsSpecification()
The settings used to enable or disable CloudWatch Contributor Insights for the specified table.
|
java.lang.Object |
getGlobalSecondaryIndexes()
Global secondary indexes to be created on the table.
|
java.lang.Object |
getImportSourceSpecification()
Specifies the properties of data being imported from the S3 bucket source to the table.
|
java.lang.Object |
getKeySchema()
Specifies the attributes that make up the primary key for the table.
|
java.lang.Object |
getKinesisStreamSpecification()
The Kinesis Data Streams configuration for the specified table.
|
java.lang.Object |
getLocalSecondaryIndexes()
Local secondary indexes to be created on the table.
|
java.lang.Object |
getPointInTimeRecoverySpecification()
The settings used to enable point in time recovery.
|
java.lang.Object |
getProvisionedThroughput()
Throughput for the specified table, which consists of values for `ReadCapacityUnits` and `WriteCapacityUnits` .
|
java.lang.Object |
getSseSpecification()
Specifies the settings to enable server-side encryption.
|
java.lang.Object |
getStreamSpecification()
The settings for the DynamoDB table stream, which capture changes to items stored in the table.
|
java.lang.String |
getTableClass()
The table class of the new table.
|
java.lang.String |
getTableName()
A name for the table.
|
TagManager |
getTags()
An array of key-value pairs to apply to this resource.
|
java.lang.Object |
getTimeToLiveSpecification()
Specifies the Time to Live (TTL) settings for the table.
|
void |
inspect(TreeInspector inspector)
Examines the CloudFormation resource and discloses attributes.
|
protected java.util.Map<java.lang.String,java.lang.Object> |
renderProperties(java.util.Map<java.lang.String,java.lang.Object> props) |
void |
setAttributeDefinitions(IResolvable value)
A list of attributes that describe the key schema for the table and indexes.
|
void |
setAttributeDefinitions(java.util.List<java.lang.Object> value)
A list of attributes that describe the key schema for the table and indexes.
|
void |
setBillingMode(java.lang.String value)
Specify how you are charged for read and write throughput and how you manage capacity.
|
void |
setContributorInsightsSpecification(CfnTable.ContributorInsightsSpecificationProperty value)
The settings used to enable or disable CloudWatch Contributor Insights for the specified table.
|
void |
setContributorInsightsSpecification(IResolvable value)
The settings used to enable or disable CloudWatch Contributor Insights for the specified table.
|
void |
setGlobalSecondaryIndexes(IResolvable value)
Global secondary indexes to be created on the table.
|
void |
setGlobalSecondaryIndexes(java.util.List<java.lang.Object> value)
Global secondary indexes to be created on the table.
|
void |
setImportSourceSpecification(CfnTable.ImportSourceSpecificationProperty value)
Specifies the properties of data being imported from the S3 bucket source to the table.
|
void |
setImportSourceSpecification(IResolvable value)
Specifies the properties of data being imported from the S3 bucket source to the table.
|
void |
setKeySchema(IResolvable value)
Specifies the attributes that make up the primary key for the table.
|
void |
setKeySchema(java.util.List<java.lang.Object> value)
Specifies the attributes that make up the primary key for the table.
|
void |
setKinesisStreamSpecification(CfnTable.KinesisStreamSpecificationProperty value)
The Kinesis Data Streams configuration for the specified table.
|
void |
setKinesisStreamSpecification(IResolvable value)
The Kinesis Data Streams configuration for the specified table.
|
void |
setLocalSecondaryIndexes(IResolvable value)
Local secondary indexes to be created on the table.
|
void |
setLocalSecondaryIndexes(java.util.List<java.lang.Object> value)
Local secondary indexes to be created on the table.
|
void |
setPointInTimeRecoverySpecification(CfnTable.PointInTimeRecoverySpecificationProperty value)
The settings used to enable point in time recovery.
|
void |
setPointInTimeRecoverySpecification(IResolvable value)
The settings used to enable point in time recovery.
|
void |
setProvisionedThroughput(CfnTable.ProvisionedThroughputProperty value)
Throughput for the specified table, which consists of values for `ReadCapacityUnits` and `WriteCapacityUnits` .
|
void |
setProvisionedThroughput(IResolvable value)
Throughput for the specified table, which consists of values for `ReadCapacityUnits` and `WriteCapacityUnits` .
|
void |
setSseSpecification(CfnTable.SSESpecificationProperty value)
Specifies the settings to enable server-side encryption.
|
void |
setSseSpecification(IResolvable value)
Specifies the settings to enable server-side encryption.
|
void |
setStreamSpecification(CfnTable.StreamSpecificationProperty value)
The settings for the DynamoDB table stream, which capture changes to items stored in the table.
|
void |
setStreamSpecification(IResolvable value)
The settings for the DynamoDB table stream, which capture changes to items stored in the table.
|
void |
setTableClass(java.lang.String value)
The table class of the new table.
|
void |
setTableName(java.lang.String value)
A name for the table.
|
void |
setTimeToLiveSpecification(CfnTable.TimeToLiveSpecificationProperty value)
Specifies the Time to Live (TTL) settings for the table.
|
void |
setTimeToLiveSpecification(IResolvable value)
Specifies the Time to Live (TTL) settings for the table.
|
addDeletionOverride, addDependsOn, addMetadata, addOverride, addPropertyDeletionOverride, addPropertyOverride, applyRemovalPolicy, applyRemovalPolicy, applyRemovalPolicy, getAtt, getCfnOptions, getCfnResourceType, getMetadata, getUpdatedProperites, isCfnResource, shouldSynthesize, toString, validateProperties
getRef
getCreationStack, getLogicalId, getStack, isCfnElement, overrideLogicalId
getNode, isConstruct, onPrepare, onSynthesize, onValidate, prepare, synthesize, validate
public static final java.lang.String CFN_RESOURCE_TYPE_NAME
protected CfnTable(software.amazon.jsii.JsiiObjectRef objRef)
protected CfnTable(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
public CfnTable(Construct scope, java.lang.String id, CfnTableProps props)
scope
- - scope in which this resource is defined. This parameter is required.id
- - scoped id of the resource. This parameter is required.props
- - resource properties. This parameter is required.public void inspect(TreeInspector inspector)
inspect
in interface IInspectable
inspector
- - tree inspector to collect and process attributes. This parameter is required.protected java.util.Map<java.lang.String,java.lang.Object> renderProperties(java.util.Map<java.lang.String,java.lang.Object> props)
renderProperties
in class CfnResource
props
- This parameter is required.public java.lang.String getAttrArn()
public java.lang.String getAttrStreamArn()
You must specify the
StreamSpecification
property to use this attribute.
protected java.util.Map<java.lang.String,java.lang.Object> getCfnProperties()
getCfnProperties
in class CfnResource
public TagManager getTags()
For more information, see Tag .
public java.lang.Object getKeySchema()
The attributes in the KeySchema
property must also be defined in the AttributeDefinitions
property.
public void setKeySchema(IResolvable value)
The attributes in the KeySchema
property must also be defined in the AttributeDefinitions
property.
public void setKeySchema(java.util.List<java.lang.Object> value)
The attributes in the KeySchema
property must also be defined in the AttributeDefinitions
property.
public java.lang.Object getAttributeDefinitions()
This property is required to create a DynamoDB table.
Update requires: Some interruptions . Replacement if you edit an existing AttributeDefinition.
public void setAttributeDefinitions(IResolvable value)
This property is required to create a DynamoDB table.
Update requires: Some interruptions . Replacement if you edit an existing AttributeDefinition.
public void setAttributeDefinitions(java.util.List<java.lang.Object> value)
This property is required to create a DynamoDB table.
Update requires: Some interruptions . Replacement if you edit an existing AttributeDefinition.
public java.lang.String getBillingMode()
Valid values include:
PROVISIONED
- We recommend using PROVISIONED
for predictable workloads. PROVISIONED
sets the billing mode to Provisioned Mode .PAY_PER_REQUEST
- We recommend using PAY_PER_REQUEST
for unpredictable workloads. PAY_PER_REQUEST
sets the billing mode to On-Demand Mode .
If not specified, the default is PROVISIONED
.
public void setBillingMode(java.lang.String value)
Valid values include:
PROVISIONED
- We recommend using PROVISIONED
for predictable workloads. PROVISIONED
sets the billing mode to Provisioned Mode .PAY_PER_REQUEST
- We recommend using PAY_PER_REQUEST
for unpredictable workloads. PAY_PER_REQUEST
sets the billing mode to On-Demand Mode .
If not specified, the default is PROVISIONED
.
public java.lang.Object getContributorInsightsSpecification()
public void setContributorInsightsSpecification(IResolvable value)
public void setContributorInsightsSpecification(CfnTable.ContributorInsightsSpecificationProperty value)
public java.lang.Object getGlobalSecondaryIndexes()
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.
public void setGlobalSecondaryIndexes(IResolvable value)
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.
public void setGlobalSecondaryIndexes(java.util.List<java.lang.Object> value)
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.
public java.lang.Object getImportSourceSpecification()
If you specify the
ImportSourceSpecification
property, and also specify either theStreamSpecification
orTableClass
property, the IAM entity creating/updating stack must haveUpdateTable
permission.
public void setImportSourceSpecification(IResolvable value)
If you specify the
ImportSourceSpecification
property, and also specify either theStreamSpecification
orTableClass
property, the IAM entity creating/updating stack must haveUpdateTable
permission.
public void setImportSourceSpecification(CfnTable.ImportSourceSpecificationProperty value)
If you specify the
ImportSourceSpecification
property, and also specify either theStreamSpecification
orTableClass
property, the IAM entity creating/updating stack must haveUpdateTable
permission.
public java.lang.Object getKinesisStreamSpecification()
public void setKinesisStreamSpecification(IResolvable value)
public void setKinesisStreamSpecification(CfnTable.KinesisStreamSpecificationProperty value)
public java.lang.Object getLocalSecondaryIndexes()
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.
public void setLocalSecondaryIndexes(IResolvable value)
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.
public void setLocalSecondaryIndexes(java.util.List<java.lang.Object> value)
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.
public java.lang.Object getPointInTimeRecoverySpecification()
public void setPointInTimeRecoverySpecification(IResolvable value)
public void setPointInTimeRecoverySpecification(CfnTable.PointInTimeRecoverySpecificationProperty value)
public java.lang.Object getProvisionedThroughput()
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.
public void setProvisionedThroughput(IResolvable value)
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.
public void setProvisionedThroughput(CfnTable.ProvisionedThroughputProperty value)
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.
public java.lang.Object getSseSpecification()
public void setSseSpecification(IResolvable value)
public void setSseSpecification(CfnTable.SSESpecificationProperty value)
public java.lang.Object getStreamSpecification()
public void setStreamSpecification(IResolvable value)
public void setStreamSpecification(CfnTable.StreamSpecificationProperty value)
public java.lang.String getTableClass()
Valid values are STANDARD
and STANDARD_INFREQUENT_ACCESS
.
public void setTableClass(java.lang.String value)
Valid values are STANDARD
and STANDARD_INFREQUENT_ACCESS
.
public java.lang.String getTableName()
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.
public void setTableName(java.lang.String value)
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.
public java.lang.Object getTimeToLiveSpecification()
For detailed information about the limits in DynamoDB, see Limits in Amazon DynamoDB in the Amazon DynamoDB Developer Guide.
public void setTimeToLiveSpecification(IResolvable value)
For detailed information about the limits in DynamoDB, see Limits in Amazon DynamoDB in the Amazon DynamoDB Developer Guide.
public void setTimeToLiveSpecification(CfnTable.TimeToLiveSpecificationProperty value)
For detailed information about the limits in DynamoDB, see Limits in Amazon DynamoDB in the Amazon DynamoDB Developer Guide.