CfnTable
- class aws_cdk.aws_dynamodb.CfnTable(scope, id, *, 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, point_in_time_recovery_specification=None, provisioned_throughput=None, sse_specification=None, stream_specification=None, table_class=None, table_name=None, tags=None, time_to_live_specification=None)
Bases:
CfnResource
A CloudFormation
AWS::DynamoDB::Table
.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.
- CloudformationResource:
AWS::DynamoDB::Table
- Link:
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. import aws_cdk.aws_dynamodb as dynamodb cfn_table = dynamodb.CfnTable(self, "MyCfnTable", 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 ), provisioned_throughput=dynamodb.CfnTable.ProvisionedThroughputProperty( read_capacity_units=123, write_capacity_units=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" ), 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" ) )], 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 ), 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" ), table_class="tableClass", table_name="tableName", tags=[CfnTag( key="key", value="value" )], time_to_live_specification=dynamodb.CfnTable.TimeToLiveSpecificationProperty( attribute_name="attributeName", enabled=False ) )
Create a new
AWS::DynamoDB::Table
.- Parameters:
scope (
Construct
) –scope in which this resource is defined.
id (
str
) –scoped id of the resource.
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, or theDeletionProtectionEnabled
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.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.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.
Methods
- add_deletion_override(path)
Syntactic sugar for
addOverride(path, undefined)
.- Parameters:
path (
str
) – The path of the value to delete.- Return type:
None
- add_depends_on(target)
Indicates that this resource depends on another resource and cannot be provisioned unless the other resource has been successfully provisioned.
This can be used for resources across stacks (or nested stack) boundaries and the dependency will automatically be transferred to the relevant scope.
- Parameters:
target (
CfnResource
)- Return type:
None
- add_metadata(key, value)
Add a value to the CloudFormation Resource Metadata.
- Parameters:
key (
str
)value (
Any
)
- See:
- Return type:
None
Note that this is a different set of metadata from CDK node metadata; this metadata ends up in the stack template under the resource, whereas CDK node metadata ends up in the Cloud Assembly.
- add_override(path, value)
Adds an override to the synthesized CloudFormation resource.
To add a property override, either use
addPropertyOverride
or prefixpath
with “Properties.” (i.e.Properties.TopicName
).If the override is nested, separate each nested level using a dot (.) in the path parameter. If there is an array as part of the nesting, specify the index in the path.
To include a literal
.
in the property name, prefix with a\
. In most programming languages you will need to write this as"\\."
because the\
itself will need to be escaped.For example:
cfn_resource.add_override("Properties.GlobalSecondaryIndexes.0.Projection.NonKeyAttributes", ["myattribute"]) cfn_resource.add_override("Properties.GlobalSecondaryIndexes.1.ProjectionType", "INCLUDE")
would add the overrides Example:
"Properties": { "GlobalSecondaryIndexes": [ { "Projection": { "NonKeyAttributes": [ "myattribute" ] ... } ... }, { "ProjectionType": "INCLUDE" ... }, ] ... }
The
value
argument toaddOverride
will not be processed or translated in any way. Pass raw JSON values in here with the correct capitalization for CloudFormation. If you pass CDK classes or structs, they will be rendered with lowercased key names, and CloudFormation will reject the template.- Parameters:
path (
str
) –The path of the property, you can use dot notation to override values in complex types. Any intermdediate keys will be created as needed.
value (
Any
) –The value. Could be primitive or complex.
- Return type:
None
- add_property_deletion_override(property_path)
Adds an override that deletes the value of a property from the resource definition.
- Parameters:
property_path (
str
) – The path to the property.- Return type:
None
- add_property_override(property_path, value)
Adds an override to a resource property.
Syntactic sugar for
addOverride("Properties.<...>", value)
.- Parameters:
property_path (
str
) – The path of the property.value (
Any
) – The value.
- Return type:
None
- apply_removal_policy(policy=None, *, apply_to_update_replace_policy=None, default=None)
Sets the deletion policy of the resource based on the removal policy specified.
The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you’ve removed it from the CDK application or because you’ve made a change that requires the resource to be replaced.
The resource can be deleted (
RemovalPolicy.DESTROY
), or left in your AWS account for data recovery and cleanup later (RemovalPolicy.RETAIN
).- Parameters:
policy (
Optional
[RemovalPolicy
])apply_to_update_replace_policy (
Optional
[bool
]) – Apply the same deletion policy to the resource’s “UpdateReplacePolicy”. Default: truedefault (
Optional
[RemovalPolicy
]) – The default policy to apply in case the removal policy is not defined. Default: - Default value is resource specific. To determine the default value for a resoure, please consult that specific resource’s documentation.
- Return type:
None
- get_att(attribute_name)
Returns a token for an runtime attribute of this resource.
Ideally, use generated attribute accessors (e.g.
resource.arn
), but this can be used for future compatibility in case there is no generated attribute.- Parameters:
attribute_name (
str
) – The name of the attribute.- Return type:
- get_metadata(key)
Retrieve a value value from the CloudFormation Resource Metadata.
- Parameters:
key (
str
)- See:
- Return type:
Any
Note that this is a different set of metadata from CDK node metadata; this metadata ends up in the stack template under the resource, whereas CDK node metadata ends up in the Cloud Assembly.
- inspect(inspector)
Examines the CloudFormation resource and discloses attributes.
- Parameters:
inspector (
TreeInspector
) –tree inspector to collect and process attributes.
- Return type:
None
- override_logical_id(new_logical_id)
Overrides the auto-generated logical ID with a specific ID.
- Parameters:
new_logical_id (
str
) – The new logical ID to use for this stack element.- Return type:
None
- to_string()
Returns a string representation of this construct.
- Return type:
str
- Returns:
a string representation of this resource
Attributes
- CFN_RESOURCE_TYPE_NAME = 'AWS::DynamoDB::Table'
- attr_arn
The Amazon Resource Name (ARN) of the DynamoDB table, such as
arn:aws:dynamodb:us-east-2:123456789012:table/myDynamoDBTable
.- CloudformationAttribute:
Arn
- attr_stream_arn
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.- CloudformationAttribute:
StreamArn
- 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
.
- cfn_options
Options for this resource, such as condition, update policy etc.
- cfn_resource_type
AWS resource type.
- contributor_insights_specification
The settings used to enable or disable CloudWatch Contributor Insights for the specified table.
- creation_stack
return:
the stack trace of the point where this Resource was created from, sourced from the +metadata+ entry typed +aws:cdk:logicalId+, and with the bottom-most node +internal+ entries filtered.
- 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, or theDeletionProtectionEnabled
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.
- logical_id
The logical ID for this CloudFormation stack element.
The logical ID of the element is calculated from the path of the resource node in the construct tree.
To override this value, use
overrideLogicalId(newLogicalId)
.- Returns:
the logical ID as a stringified token. This value will only get resolved during synthesis.
- node
The construct tree node associated with this construct.
- 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.
- ref
Return a string that will be resolved to a CloudFormation
{ Ref }
for this element.If, by any chance, the intrinsic reference of a resource is not a string, you could coerce it to an IResolvable through
Lazy.any({ produce: resource.ref })
.
- sse_specification
Specifies the settings to enable server-side encryption.
- stack
The stack in which this element is defined.
CfnElements must be defined within a stack scope (directly or indirectly).
- 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.
Static Methods
- classmethod is_cfn_element(x)
Returns
true
if a construct is a stack element (i.e. part of the synthesized cloudformation template).Uses duck-typing instead of
instanceof
to allow stack elements from different versions of this library to be included in the same stack.- Parameters:
x (
Any
)- Return type:
bool
- Returns:
The construct as a stack element or undefined if it is not a stack element.
- classmethod is_cfn_resource(construct)
Check whether the given construct is a CfnResource.
- Parameters:
construct (
IConstruct
)- Return type:
bool
- classmethod is_construct(x)
Return whether the given object is a Construct.
- Parameters:
x (
Any
)- Return type:
bool
AttributeDefinitionProperty
- class CfnTable.AttributeDefinitionProperty(*, attribute_name, attribute_type)
Bases:
object
Represents an attribute for describing the key schema for the table and indexes.
- Parameters:
attribute_name (
str
) – A name for the attribute.attribute_type (
str
) – The data type for the attribute, where:. -S
- the attribute is of type String -N
- the attribute is of type Number -B
- the attribute is of type Binary
- Link:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_dynamodb as dynamodb attribute_definition_property = dynamodb.CfnTable.AttributeDefinitionProperty( attribute_name="attributeName", attribute_type="attributeType" )
Attributes
- attribute_name
A name for the attribute.
- attribute_type
.
S
- the attribute is of type StringN
- the attribute is of type NumberB
- the attribute is of type Binary
- Link:
- Type:
The data type for the attribute, where
ContributorInsightsSpecificationProperty
- class CfnTable.ContributorInsightsSpecificationProperty(*, enabled)
Bases:
object
The settings used to enable or disable CloudWatch Contributor Insights.
- Parameters:
enabled (
Union
[bool
,IResolvable
]) – Indicates whether CloudWatch Contributor Insights are to be enabled (true) or disabled (false).- Link:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_dynamodb as dynamodb contributor_insights_specification_property = dynamodb.CfnTable.ContributorInsightsSpecificationProperty( enabled=False )
Attributes
- enabled
Indicates whether CloudWatch Contributor Insights are to be enabled (true) or disabled (false).
CsvProperty
- class CfnTable.CsvProperty(*, delimiter=None, header_list=None)
Bases:
object
The options for imported source files in CSV format.
The values are Delimiter and HeaderList.
- Parameters:
delimiter (
Optional
[str
]) – The delimiter used for separating items in the CSV file being imported.header_list (
Optional
[Sequence
[str
]]) – List of the headers used to specify a common header for all source CSV files being imported. If this field is specified then the first line of each CSV file is treated as data instead of the header. If this field is not specified the the first line of each CSV file is treated as the header.
- Link:
http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-dynamodb-table-csv.html
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_dynamodb as dynamodb csv_property = dynamodb.CfnTable.CsvProperty( delimiter="delimiter", header_list=["headerList"] )
Attributes
- delimiter
The delimiter used for separating items in the CSV file being imported.
- header_list
List of the headers used to specify a common header for all source CSV files being imported.
If this field is specified then the first line of each CSV file is treated as data instead of the header. If this field is not specified the the first line of each CSV file is treated as the header.
GlobalSecondaryIndexProperty
- class CfnTable.GlobalSecondaryIndexProperty(*, index_name, key_schema, projection, contributor_insights_specification=None, provisioned_throughput=None)
Bases:
object
Represents the properties of a global secondary index.
- Parameters:
index_name (
str
) – The name of the global secondary index. The name must be unique among all other indexes on this table.key_schema (
Union
[IResolvable
,Sequence
[Union
[IResolvable
,KeySchemaProperty
,Dict
[str
,Any
]]]]) – The complete key schema for a global secondary index, which consists of one or more pairs of attribute names and key types: -HASH
- partition key -RANGE
- sort key > The partition key of an item is also known as its hash attribute . The term “hash attribute” derives from DynamoDB’s usage of an internal hash function to evenly distribute data items across partitions, based on their partition key values. .. epigraph:: The sort key of an item is also known as its range attribute . The term “range attribute” derives from the way DynamoDB stores items with the same partition key physically close together, in sorted order by the sort key value.projection (
Union
[IResolvable
,ProjectionProperty
,Dict
[str
,Any
]]) – Represents attributes that are copied (projected) from the table into the global secondary index. These are in addition to the primary key attributes and index key attributes, which are automatically projected.contributor_insights_specification (
Union
[IResolvable
,ContributorInsightsSpecificationProperty
,Dict
[str
,Any
],None
]) – The settings used to enable or disable CloudWatch Contributor Insights for the specified global secondary index.provisioned_throughput (
Union
[IResolvable
,ProvisionedThroughputProperty
,Dict
[str
,Any
],None
]) – Represents the provisioned throughput settings for the specified global secondary index. For current minimum and maximum provisioned throughput values, see Service, Account, and Table Quotas in the Amazon DynamoDB Developer Guide .
- Link:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_dynamodb as dynamodb global_secondary_index_property = 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 ), provisioned_throughput=dynamodb.CfnTable.ProvisionedThroughputProperty( read_capacity_units=123, write_capacity_units=123 ) )
Attributes
- contributor_insights_specification
The settings used to enable or disable CloudWatch Contributor Insights for the specified global secondary index.
- index_name
The name of the global secondary index.
The name must be unique among all other indexes on this table.
- key_schema
HASH
- partition key -RANGE
- sort key > The partition key of an item is also known as its hash attribute .
The term “hash attribute” derives from DynamoDB’s usage of an internal hash function to evenly distribute data items across partitions, based on their partition key values. .. epigraph:
The sort key of an item is also known as its *range attribute* . The term "range attribute" derives from the way DynamoDB stores items with the same partition key physically close together, in sorted order by the sort key value.
- Link:
- Type:
The complete key schema for a global secondary index, which consists of one or more pairs of attribute names and key types
- projection
Represents attributes that are copied (projected) from the table into the global secondary index.
These are in addition to the primary key attributes and index key attributes, which are automatically projected.
- provisioned_throughput
Represents the provisioned throughput settings for the specified global secondary index.
For current minimum and maximum provisioned throughput values, see Service, Account, and Table Quotas in the Amazon DynamoDB Developer Guide .
ImportSourceSpecificationProperty
- class CfnTable.ImportSourceSpecificationProperty(*, input_format, s3_bucket_source, input_compression_type=None, input_format_options=None)
Bases:
object
Specifies the properties of data being imported from the S3 bucket source to the table.
- Parameters:
input_format (
str
) – The format of the source data. Valid values forImportFormat
areCSV
,DYNAMODB_JSON
orION
.s3_bucket_source (
Union
[IResolvable
,S3BucketSourceProperty
,Dict
[str
,Any
]]) – The S3 bucket that provides the source for the import.input_compression_type (
Optional
[str
]) – Type of compression to be used on the input coming from the imported table.input_format_options (
Union
[IResolvable
,InputFormatOptionsProperty
,Dict
[str
,Any
],None
]) – Additional properties that specify how the input is formatted,.
- Link:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_dynamodb as dynamodb import_source_specification_property = 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"] ) ) )
Attributes
- input_compression_type
Type of compression to be used on the input coming from the imported table.
- input_format
The format of the source data.
Valid values for
ImportFormat
areCSV
,DYNAMODB_JSON
orION
.
- input_format_options
Additional properties that specify how the input is formatted,.
- s3_bucket_source
The S3 bucket that provides the source for the import.
InputFormatOptionsProperty
- class CfnTable.InputFormatOptionsProperty(*, csv=None)
Bases:
object
The format options for the data that was imported into the target table.
There is one value, CsvOption.
- Parameters:
csv (
Union
[IResolvable
,CsvProperty
,Dict
[str
,Any
],None
]) – The options for imported source files in CSV format. The values are Delimiter and HeaderList.- Link:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_dynamodb as dynamodb input_format_options_property = dynamodb.CfnTable.InputFormatOptionsProperty( csv=dynamodb.CfnTable.CsvProperty( delimiter="delimiter", header_list=["headerList"] ) )
Attributes
- csv
The options for imported source files in CSV format.
The values are Delimiter and HeaderList.
KeySchemaProperty
- class CfnTable.KeySchemaProperty(*, attribute_name, key_type)
Bases:
object
Represents a single element of a key schema.
A key schema specifies the attributes that make up the primary key of a table, or the key attributes of an index.
A
KeySchemaElement
represents exactly one attribute of the primary key. For example, a simple primary key would be represented by oneKeySchemaElement
(for the partition key). A composite primary key would require oneKeySchemaElement
for the partition key, and anotherKeySchemaElement
for the sort key.A
KeySchemaElement
must be a scalar, top-level attribute (not a nested attribute). The data type must be one of String, Number, or Binary. The attribute cannot be nested within a List or a Map.- Parameters:
attribute_name (
str
) – The name of a key attribute.key_type (
str
) – The role that this key attribute will assume:. -HASH
- partition key -RANGE
- sort key .. epigraph:: The partition key of an item is also known as its hash attribute . The term “hash attribute” derives from DynamoDB’s usage of an internal hash function to evenly distribute data items across partitions, based on their partition key values. The sort key of an item is also known as its range attribute . The term “range attribute” derives from the way DynamoDB stores items with the same partition key physically close together, in sorted order by the sort key value.
- Link:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_dynamodb as dynamodb key_schema_property = dynamodb.CfnTable.KeySchemaProperty( attribute_name="attributeName", key_type="keyType" )
Attributes
- attribute_name
The name of a key attribute.
- key_type
.
HASH
- partition keyRANGE
- sort key
The partition key of an item is also known as its hash attribute . The term “hash attribute” derives from DynamoDB’s usage of an internal hash function to evenly distribute data items across partitions, based on their partition key values.
The sort key of an item is also known as its range attribute . The term “range attribute” derives from the way DynamoDB stores items with the same partition key physically close together, in sorted order by the sort key value.
- Link:
- Type:
The role that this key attribute will assume
KinesisStreamSpecificationProperty
- class CfnTable.KinesisStreamSpecificationProperty(*, stream_arn)
Bases:
object
The Kinesis Data Streams configuration for the specified table.
- Parameters:
stream_arn (
str
) – The ARN for a specific Kinesis data stream. Length Constraints: Minimum length of 37. Maximum length of 1024.- Link:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_dynamodb as dynamodb kinesis_stream_specification_property = dynamodb.CfnTable.KinesisStreamSpecificationProperty( stream_arn="streamArn" )
Attributes
- stream_arn
The ARN for a specific Kinesis data stream.
Length Constraints: Minimum length of 37. Maximum length of 1024.
LocalSecondaryIndexProperty
- class CfnTable.LocalSecondaryIndexProperty(*, index_name, key_schema, projection)
Bases:
object
Represents the properties of a local secondary index.
A local secondary index can only be created when its parent table is created.
- Parameters:
index_name (
str
) – The name of the local secondary index. The name must be unique among all other indexes on this table.key_schema (
Union
[IResolvable
,Sequence
[Union
[IResolvable
,KeySchemaProperty
,Dict
[str
,Any
]]]]) – The complete key schema for the local secondary index, consisting of one or more pairs of attribute names and key types: -HASH
- partition key -RANGE
- sort key > The partition key of an item is also known as its hash attribute . The term “hash attribute” derives from DynamoDB’s usage of an internal hash function to evenly distribute data items across partitions, based on their partition key values. .. epigraph:: The sort key of an item is also known as its range attribute . The term “range attribute” derives from the way DynamoDB stores items with the same partition key physically close together, in sorted order by the sort key value.projection (
Union
[IResolvable
,ProjectionProperty
,Dict
[str
,Any
]]) – Represents attributes that are copied (projected) from the table into the local secondary index. These are in addition to the primary key attributes and index key attributes, which are automatically projected.
- Link:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_dynamodb as dynamodb local_secondary_index_property = 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" ) )
Attributes
- index_name
The name of the local secondary index.
The name must be unique among all other indexes on this table.
- key_schema
HASH
- partition key -RANGE
- sort key > The partition key of an item is also known as its hash attribute .
The term “hash attribute” derives from DynamoDB’s usage of an internal hash function to evenly distribute data items across partitions, based on their partition key values. .. epigraph:
The sort key of an item is also known as its *range attribute* . The term "range attribute" derives from the way DynamoDB stores items with the same partition key physically close together, in sorted order by the sort key value.
- Link:
- Type:
The complete key schema for the local secondary index, consisting of one or more pairs of attribute names and key types
- projection
Represents attributes that are copied (projected) from the table into the local secondary index.
These are in addition to the primary key attributes and index key attributes, which are automatically projected.
PointInTimeRecoverySpecificationProperty
- class CfnTable.PointInTimeRecoverySpecificationProperty(*, point_in_time_recovery_enabled=None)
Bases:
object
The settings used to enable point in time recovery.
- Parameters:
point_in_time_recovery_enabled (
Union
[bool
,IResolvable
,None
]) – Indicates whether point in time recovery is enabled (true) or disabled (false) on the table.- Link:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_dynamodb as dynamodb point_in_time_recovery_specification_property = dynamodb.CfnTable.PointInTimeRecoverySpecificationProperty( point_in_time_recovery_enabled=False )
Attributes
- point_in_time_recovery_enabled
Indicates whether point in time recovery is enabled (true) or disabled (false) on the table.
ProjectionProperty
- class CfnTable.ProjectionProperty(*, non_key_attributes=None, projection_type=None)
Bases:
object
Represents attributes that are copied (projected) from the table into an index.
These are in addition to the primary key attributes and index key attributes, which are automatically projected.
- Parameters:
non_key_attributes (
Optional
[Sequence
[str
]]) – Represents the non-key attribute names which will be projected into the index. For local secondary indexes, the total count ofNonKeyAttributes
summed across all of the local secondary indexes, must not exceed 100. If you project the same attribute into two different indexes, this counts as two distinct attributes when determining the total.projection_type (
Optional
[str
]) – The set of attributes that are projected into the index:. -KEYS_ONLY
- Only the index and primary keys are projected into the index. -INCLUDE
- In addition to the attributes described inKEYS_ONLY
, the secondary index will include other non-key attributes that you specify. -ALL
- All of the table attributes are projected into the index.
- Link:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_dynamodb as dynamodb projection_property = dynamodb.CfnTable.ProjectionProperty( non_key_attributes=["nonKeyAttributes"], projection_type="projectionType" )
Attributes
- non_key_attributes
Represents the non-key attribute names which will be projected into the index.
For local secondary indexes, the total count of
NonKeyAttributes
summed across all of the local secondary indexes, must not exceed 100. If you project the same attribute into two different indexes, this counts as two distinct attributes when determining the total.
- projection_type
.
KEYS_ONLY
- Only the index and primary keys are projected into the index.INCLUDE
- In addition to the attributes described inKEYS_ONLY
, the secondary index will include other non-key attributes that you specify.ALL
- All of the table attributes are projected into the index.
- Link:
- Type:
The set of attributes that are projected into the index
ProvisionedThroughputProperty
- class CfnTable.ProvisionedThroughputProperty(*, read_capacity_units, write_capacity_units)
Bases:
object
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 .
- Parameters:
read_capacity_units (
Union
[int
,float
]) – The maximum number of strongly consistent reads consumed per second before DynamoDB returns aThrottlingException
. For more information, see Specifying Read and Write Requirements in the Amazon DynamoDB Developer Guide . If read/write capacity mode isPAY_PER_REQUEST
the value is set to 0.write_capacity_units (
Union
[int
,float
]) –The maximum number of writes consumed per second before DynamoDB returns a
ThrottlingException
. For more information, see Specifying Read and Write Requirements in the Amazon DynamoDB Developer Guide . If read/write capacity mode isPAY_PER_REQUEST
the value is set to 0.
- Link:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_dynamodb as dynamodb provisioned_throughput_property = dynamodb.CfnTable.ProvisionedThroughputProperty( read_capacity_units=123, write_capacity_units=123 )
Attributes
- read_capacity_units
The maximum number of strongly consistent reads consumed per second before DynamoDB returns a
ThrottlingException
.For more information, see Specifying Read and Write Requirements in the Amazon DynamoDB Developer Guide .
If read/write capacity mode is
PAY_PER_REQUEST
the value is set to 0.
- write_capacity_units
The maximum number of writes consumed per second before DynamoDB returns a
ThrottlingException
.For more information, see Specifying Read and Write Requirements in the Amazon DynamoDB Developer Guide .
If read/write capacity mode is
PAY_PER_REQUEST
the value is set to 0.
S3BucketSourceProperty
- class CfnTable.S3BucketSourceProperty(*, s3_bucket, s3_bucket_owner=None, s3_key_prefix=None)
Bases:
object
The S3 bucket that is being imported from.
- Parameters:
s3_bucket (
str
) – The S3 bucket that is being imported from.s3_bucket_owner (
Optional
[str
]) – The account number of the S3 bucket that is being imported from. If the bucket is owned by the requester this is optional.s3_key_prefix (
Optional
[str
]) – The key prefix shared by all S3 Objects that are being imported.
- Link:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_dynamodb as dynamodb s3_bucket_source_property = dynamodb.CfnTable.S3BucketSourceProperty( s3_bucket="s3Bucket", # the properties below are optional s3_bucket_owner="s3BucketOwner", s3_key_prefix="s3KeyPrefix" )
Attributes
- s3_bucket
The S3 bucket that is being imported from.
- s3_bucket_owner
The account number of the S3 bucket that is being imported from.
If the bucket is owned by the requester this is optional.
- s3_key_prefix
The key prefix shared by all S3 Objects that are being imported.
SSESpecificationProperty
- class CfnTable.SSESpecificationProperty(*, sse_enabled, kms_master_key_id=None, sse_type=None)
Bases:
object
Represents the settings used to enable server-side encryption.
- Parameters:
sse_enabled (
Union
[bool
,IResolvable
]) – Indicates whether server-side encryption is done using an AWS managed key or an AWS owned key. If enabled (true), server-side encryption type is set toKMS
and an AWS managed key is used ( AWS KMS charges apply). If disabled (false) or not specified, server-side encryption is set to AWS owned key.kms_master_key_id (
Optional
[str
]) – The AWS KMS key that should be used for the AWS KMS encryption. To specify a key, use its key ID, Amazon Resource Name (ARN), alias name, or alias ARN. Note that you should only provide this parameter if the key is different from the default DynamoDB keyalias/aws/dynamodb
.sse_type (
Optional
[str
]) – Server-side encryption type. The only supported value is:. -KMS
- Server-side encryption that uses AWS Key Management Service . The key is stored in your account and is managed by AWS KMS ( AWS KMS charges apply).
- Link:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_dynamodb as dynamodb s_sESpecification_property = dynamodb.CfnTable.SSESpecificationProperty( sse_enabled=False, # the properties below are optional kms_master_key_id="kmsMasterKeyId", sse_type="sseType" )
Attributes
- kms_master_key_id
The AWS KMS key that should be used for the AWS KMS encryption.
To specify a key, use its key ID, Amazon Resource Name (ARN), alias name, or alias ARN. Note that you should only provide this parameter if the key is different from the default DynamoDB key
alias/aws/dynamodb
.
- sse_enabled
Indicates whether server-side encryption is done using an AWS managed key or an AWS owned key.
If enabled (true), server-side encryption type is set to
KMS
and an AWS managed key is used ( AWS KMS charges apply). If disabled (false) or not specified, server-side encryption is set to AWS owned key.
- sse_type
.
KMS
- Server-side encryption that uses AWS Key Management Service . The key is stored in your account and is managed by AWS KMS ( AWS KMS charges apply).
- Link:
- Type:
Server-side encryption type. The only supported value is
StreamSpecificationProperty
- class CfnTable.StreamSpecificationProperty(*, stream_view_type)
Bases:
object
Represents the DynamoDB Streams configuration for a table in DynamoDB.
- Parameters:
stream_view_type (
str
) – When an item in the table is modified,StreamViewType
determines what information is written to the stream for this table. Valid values forStreamViewType
are: -KEYS_ONLY
- Only the key attributes of the modified item are written to the stream. -NEW_IMAGE
- The entire item, as it appears after it was modified, is written to the stream. -OLD_IMAGE
- The entire item, as it appeared before it was modified, is written to the stream. -NEW_AND_OLD_IMAGES
- Both the new and the old item images of the item are written to the stream.- Link:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_dynamodb as dynamodb stream_specification_property = dynamodb.CfnTable.StreamSpecificationProperty( stream_view_type="streamViewType" )
Attributes
- stream_view_type
When an item in the table is modified,
StreamViewType
determines what information is written to the stream for this table.Valid values for
StreamViewType
are:KEYS_ONLY
- Only the key attributes of the modified item are written to the stream.NEW_IMAGE
- The entire item, as it appears after it was modified, is written to the stream.OLD_IMAGE
- The entire item, as it appeared before it was modified, is written to the stream.NEW_AND_OLD_IMAGES
- Both the new and the old item images of the item are written to the stream.
TimeToLiveSpecificationProperty
- class CfnTable.TimeToLiveSpecificationProperty(*, attribute_name, enabled)
Bases:
object
Represents the settings used to enable or disable Time to Live (TTL) for the specified table.
- Parameters:
attribute_name (
str
) – The name of the TTL attribute used to store the expiration time for items in the table. .. epigraph:: - To update this property, you must first disable TTL and then enable TTL with the new attribute name.enabled (
Union
[bool
,IResolvable
]) – Indicates whether TTL is to be enabled (true) or disabled (false) on the table.
- Link:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_dynamodb as dynamodb time_to_live_specification_property = dynamodb.CfnTable.TimeToLiveSpecificationProperty( attribute_name="attributeName", enabled=False )
Attributes
- attribute_name
The name of the TTL attribute used to store the expiration time for items in the table.
To update this property, you must first disable TTL and then enable TTL with the new attribute name.
- enabled
Indicates whether TTL is to be enabled (true) or disabled (false) on the table.