CfnTableProps
- class aws_cdk.aws_dynamodb.CfnTableProps(*, key_schema, attribute_definitions=None, billing_mode=None, contributor_insights_specification=None, deletion_protection_enabled=None, global_secondary_indexes=None, import_source_specification=None, kinesis_stream_specification=None, local_secondary_indexes=None, on_demand_throughput=None, point_in_time_recovery_specification=None, provisioned_throughput=None, resource_policy=None, sse_specification=None, stream_specification=None, table_class=None, table_name=None, tags=None, time_to_live_specification=None, warm_throughput=None)
Bases:
object
Properties for defining a
CfnTable
.- Parameters:
key_schema (
Union
[IResolvable
,Sequence
[Union
[IResolvable
,KeySchemaProperty
,Dict
[str
,Any
]]]]) – Specifies the attributes that make up the primary key for the table. The attributes in theKeySchema
property must also be defined in theAttributeDefinitions
property.attribute_definitions (
Union
[IResolvable
,Sequence
[Union
[IResolvable
,AttributeDefinitionProperty
,Dict
[str
,Any
]]],None
]) – A list of attributes that describe the key schema for the table and indexes. This property is required to create a DynamoDB table. Update requires: Some interruptions . Replacement if you edit an existing AttributeDefinition.billing_mode (
Optional
[str
]) – Specify how you are charged for read and write throughput and how you manage capacity. Valid values include: -PROVISIONED
- We recommend usingPROVISIONED
for predictable workloads.PROVISIONED
sets the billing mode to Provisioned Mode . -PAY_PER_REQUEST
- We recommend usingPAY_PER_REQUEST
for unpredictable workloads.PAY_PER_REQUEST
sets the billing mode to On-Demand Mode . If not specified, the default isPROVISIONED
.contributor_insights_specification (
Union
[IResolvable
,ContributorInsightsSpecificationProperty
,Dict
[str
,Any
],None
]) – The settings used to enable or disable CloudWatch Contributor Insights for the specified table.deletion_protection_enabled (
Union
[bool
,IResolvable
,None
]) – Determines if a table is protected from deletion. 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 .global_secondary_indexes (
Union
[IResolvable
,Sequence
[Union
[IResolvable
,GlobalSecondaryIndexProperty
,Dict
[str
,Any
]]],None
]) – Global secondary indexes to be created on the table. You can create up to 20 global secondary indexes. .. epigraph:: 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 isACTIVE
. 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.import_source_specification (
Union
[IResolvable
,ImportSourceSpecificationProperty
,Dict
[str
,Any
],None
]) – Specifies the properties of data being imported from the S3 bucket source to the” table. .. epigraph:: If you specify theImportSourceSpecification
property, and also specify either theStreamSpecification
, theTableClass
property, theDeletionProtectionEnabled
property, or theWarmThroughput
property, the IAM entity creating/updating stack must haveUpdateTable
permission.kinesis_stream_specification (
Union
[IResolvable
,KinesisStreamSpecificationProperty
,Dict
[str
,Any
],None
]) – The Kinesis Data Streams configuration for the specified table.local_secondary_indexes (
Union
[IResolvable
,Sequence
[Union
[IResolvable
,LocalSecondaryIndexProperty
,Dict
[str
,Any
]]],None
]) – Local secondary indexes to be created on the table. 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.on_demand_throughput (
Union
[IResolvable
,OnDemandThroughputProperty
,Dict
[str
,Any
],None
]) – Sets the maximum number of read and write units for the specified on-demand table. If you use this property, you must specifyMaxReadRequestUnits
,MaxWriteRequestUnits
, or both.point_in_time_recovery_specification (
Union
[IResolvable
,PointInTimeRecoverySpecificationProperty
,Dict
[str
,Any
],None
]) – The settings used to enable point in time recovery.provisioned_throughput (
Union
[IResolvable
,ProvisionedThroughputProperty
,Dict
[str
,Any
],None
]) – Throughput for the specified table, which consists of values forReadCapacityUnits
andWriteCapacityUnits
. For more information about the contents of a provisioned throughput structure, see Amazon DynamoDB Table ProvisionedThroughput . If you setBillingMode
asPROVISIONED
, you must specify this property. If you setBillingMode
asPAY_PER_REQUEST
, you cannot specify this property.resource_policy (
Union
[IResolvable
,ResourcePolicyProperty
,Dict
[str
,Any
],None
]) – A resource-based policy document that contains permissions to add to the specified table. In a CloudFormation template, you can provide the policy in JSON or YAML format because CloudFormation converts YAML to JSON before submitting it to DynamoDB . For more information about resource-based policies, see Using resource-based policies for DynamoDB and Resource-based policy examples . When you attach a resource-based policy while creating a table, the policy creation is strongly consistent . For information about the considerations that you should keep in mind while attaching a resource-based policy, see Resource-based policy considerations .sse_specification (
Union
[IResolvable
,SSESpecificationProperty
,Dict
[str
,Any
],None
]) – Specifies the settings to enable server-side encryption.stream_specification (
Union
[IResolvable
,StreamSpecificationProperty
,Dict
[str
,Any
],None
]) – The settings for the DynamoDB table stream, which capture changes to items stored in the table.table_class (
Optional
[str
]) – The table class of the new table. Valid values areSTANDARD
andSTANDARD_INFREQUENT_ACCESS
.table_name (
Optional
[str
]) – A name for the table. 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 . .. epigraph:: 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.tags (
Optional
[Sequence
[Union
[CfnTag
,Dict
[str
,Any
]]]]) – An array of key-value pairs to apply to this resource. For more information, see Tag .time_to_live_specification (
Union
[IResolvable
,TimeToLiveSpecificationProperty
,Dict
[str
,Any
],None
]) – Specifies the Time to Live (TTL) settings for the table. .. epigraph:: For detailed information about the limits in DynamoDB, see Limits in Amazon DynamoDB in the Amazon DynamoDB Developer Guide.warm_throughput (
Union
[IResolvable
,WarmThroughputProperty
,Dict
[str
,Any
],None
]) – Represents the warm throughput (in read units per second and write units per second) for creating a table.
- See:
http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-dynamodb-table.html
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. from aws_cdk import aws_dynamodb as dynamodb # policy_document: Any cfn_table_props = dynamodb.CfnTableProps( key_schema=[dynamodb.CfnTable.KeySchemaProperty( attribute_name="attributeName", key_type="keyType" )], # the properties below are optional attribute_definitions=[dynamodb.CfnTable.AttributeDefinitionProperty( attribute_name="attributeName", attribute_type="attributeType" )], billing_mode="billingMode", contributor_insights_specification=dynamodb.CfnTable.ContributorInsightsSpecificationProperty( enabled=False ), deletion_protection_enabled=False, global_secondary_indexes=[dynamodb.CfnTable.GlobalSecondaryIndexProperty( index_name="indexName", key_schema=[dynamodb.CfnTable.KeySchemaProperty( attribute_name="attributeName", key_type="keyType" )], projection=dynamodb.CfnTable.ProjectionProperty( non_key_attributes=["nonKeyAttributes"], projection_type="projectionType" ), # the properties below are optional contributor_insights_specification=dynamodb.CfnTable.ContributorInsightsSpecificationProperty( enabled=False ), on_demand_throughput=dynamodb.CfnTable.OnDemandThroughputProperty( max_read_request_units=123, max_write_request_units=123 ), provisioned_throughput=dynamodb.CfnTable.ProvisionedThroughputProperty( read_capacity_units=123, write_capacity_units=123 ), warm_throughput=dynamodb.CfnTable.WarmThroughputProperty( read_units_per_second=123, write_units_per_second=123 ) )], import_source_specification=dynamodb.CfnTable.ImportSourceSpecificationProperty( input_format="inputFormat", s3_bucket_source=dynamodb.CfnTable.S3BucketSourceProperty( s3_bucket="s3Bucket", # the properties below are optional s3_bucket_owner="s3BucketOwner", s3_key_prefix="s3KeyPrefix" ), # the properties below are optional input_compression_type="inputCompressionType", input_format_options=dynamodb.CfnTable.InputFormatOptionsProperty( csv=dynamodb.CfnTable.CsvProperty( delimiter="delimiter", header_list=["headerList"] ) ) ), kinesis_stream_specification=dynamodb.CfnTable.KinesisStreamSpecificationProperty( stream_arn="streamArn", # the properties below are optional approximate_creation_date_time_precision="approximateCreationDateTimePrecision" ), local_secondary_indexes=[dynamodb.CfnTable.LocalSecondaryIndexProperty( index_name="indexName", key_schema=[dynamodb.CfnTable.KeySchemaProperty( attribute_name="attributeName", key_type="keyType" )], projection=dynamodb.CfnTable.ProjectionProperty( non_key_attributes=["nonKeyAttributes"], projection_type="projectionType" ) )], on_demand_throughput=dynamodb.CfnTable.OnDemandThroughputProperty( max_read_request_units=123, max_write_request_units=123 ), point_in_time_recovery_specification=dynamodb.CfnTable.PointInTimeRecoverySpecificationProperty( point_in_time_recovery_enabled=False ), provisioned_throughput=dynamodb.CfnTable.ProvisionedThroughputProperty( read_capacity_units=123, write_capacity_units=123 ), resource_policy=dynamodb.CfnTable.ResourcePolicyProperty( policy_document=policy_document ), sse_specification=dynamodb.CfnTable.SSESpecificationProperty( sse_enabled=False, # the properties below are optional kms_master_key_id="kmsMasterKeyId", sse_type="sseType" ), stream_specification=dynamodb.CfnTable.StreamSpecificationProperty( stream_view_type="streamViewType", # the properties below are optional resource_policy=dynamodb.CfnTable.ResourcePolicyProperty( policy_document=policy_document ) ), table_class="tableClass", table_name="tableName", tags=[CfnTag( key="key", value="value" )], time_to_live_specification=dynamodb.CfnTable.TimeToLiveSpecificationProperty( enabled=False, # the properties below are optional attribute_name="attributeName" ), warm_throughput=dynamodb.CfnTable.WarmThroughputProperty( read_units_per_second=123, write_units_per_second=123 ) )
Attributes
- attribute_definitions
A list of attributes that describe the key schema for the table and indexes.
This property is required to create a DynamoDB table.
Update requires: Some interruptions . Replacement if you edit an existing AttributeDefinition.
- billing_mode
Specify how you are charged for read and write throughput and how you manage capacity.
Valid values include:
PROVISIONED
- We recommend usingPROVISIONED
for predictable workloads.PROVISIONED
sets the billing mode to Provisioned Mode .PAY_PER_REQUEST
- We recommend usingPAY_PER_REQUEST
for unpredictable workloads.PAY_PER_REQUEST
sets the billing mode to On-Demand Mode .
If not specified, the default is
PROVISIONED
.
- contributor_insights_specification
The settings used to enable or disable CloudWatch Contributor Insights for the specified table.
- deletion_protection_enabled
Determines if a table is protected from deletion.
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 .
- global_secondary_indexes
Global secondary indexes to be created on the table. You can create up to 20 global secondary indexes.
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.
- import_source_specification
Specifies the properties of data being imported from the S3 bucket source to the” table.
If you specify the
ImportSourceSpecification
property, and also specify either theStreamSpecification
, theTableClass
property, theDeletionProtectionEnabled
property, or theWarmThroughput
property, the IAM entity creating/updating stack must haveUpdateTable
permission.
- key_schema
Specifies the attributes that make up the primary key for the table.
The attributes in the
KeySchema
property must also be defined in theAttributeDefinitions
property.
- kinesis_stream_specification
The Kinesis Data Streams configuration for the specified table.
- local_secondary_indexes
Local secondary indexes to be created on the table.
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.
- on_demand_throughput
Sets the maximum number of read and write units for the specified on-demand table.
If you use this property, you must specify
MaxReadRequestUnits
,MaxWriteRequestUnits
, or both.
- point_in_time_recovery_specification
The settings used to enable point in time recovery.
- provisioned_throughput
Throughput for the specified table, which consists of values for
ReadCapacityUnits
andWriteCapacityUnits
.For more information about the contents of a provisioned throughput structure, see Amazon DynamoDB Table ProvisionedThroughput .
If you set
BillingMode
asPROVISIONED
, you must specify this property. If you setBillingMode
asPAY_PER_REQUEST
, you cannot specify this property.
- resource_policy
A resource-based policy document that contains permissions to add to the specified table.
In a CloudFormation template, you can provide the policy in JSON or YAML format because CloudFormation converts YAML to JSON before submitting it to DynamoDB . For more information about resource-based policies, see Using resource-based policies for DynamoDB and Resource-based policy examples .
When you attach a resource-based policy while creating a table, the policy creation is strongly consistent . For information about the considerations that you should keep in mind while attaching a resource-based policy, see Resource-based policy considerations .
- sse_specification
Specifies the settings to enable server-side encryption.
- stream_specification
The settings for the DynamoDB table stream, which capture changes to items stored in the table.
- table_class
The table class of the new table.
Valid values are
STANDARD
andSTANDARD_INFREQUENT_ACCESS
.
- table_name
A name for the table.
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 . .. epigraph:
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.
- time_to_live_specification
Specifies the Time to Live (TTL) settings for the table.
For detailed information about the limits in DynamoDB, see Limits in Amazon DynamoDB in the Amazon DynamoDB Developer Guide.
- warm_throughput
Represents the warm throughput (in read units per second and write units per second) for creating a table.