AWS::DynamoDB::Table¶
The AWS::DynamoDB::Table resource creates a DDB table.
Generated by cfn-typegen --out cfn_types AWS::DynamoDB::Table into cfn_types/dynamodb.py:
# Generated by cfn-typegen from the CloudFormation registry schemas. Do not edit.
# fmt: off
# ruff: noqa
"""AWS::DynamoDB resources."""
from collections.abc import Mapping, Sequence
from typing import Any, Literal, NotRequired, Unpack
from typing_extensions import TypedDict
from cfn_typed.base import DeletionPolicy, DependsOn, ResourceAttrs, Tag, UpdateReplacePolicy, build
from cfn_typed.intrinsics import Expr
_c0={'P':{'MaxReadRequestUnits':{'m':1},'MaxWriteRequestUnits':{'m':1}}}
_c1={'P':{'Mode':{'e':["ACCESSED_AND_THROTTLED_KEYS","THROTTLED_KEYS"]}}}
_c2={'P':{'ReadUnitsPerSecond':{'m':1},'WriteUnitsPerSecond':{'m':1}}}
CONSTRAINTS:dict[str,Any]={
'AWS::DynamoDB::Table':{'OnDemandThroughput':_c0,'KinesisStreamSpecification':{'P':{'ApproximateCreationDateTimePrecision':{'e':["MICROSECOND","MILLISECOND"]}}},'ContributorInsightsSpecification':_c1,'PointInTimeRecoverySpecification':{'P':{'RecoveryPeriodInDays':{'m':1,'M':35}}},'WarmThroughput':_c2,'VectorIndexes':{'i':1,'T':{'P':{'Dimensions':{'m':1,'M':4096},'SearchSchema':{'i':1,'T':{'P':{'SearchSchemaElementType':{'e':["HASH","INLINE_FILTER"]}}}},'DistanceFunction':{'e':["COSINE","DOT_PRODUCT","EUCLIDEAN"]}}}},'GlobalSecondaryIndexes':{'T':{'P':{'OnDemandThroughput':_c0,'ContributorInsightsSpecification':_c1,'WarmThroughput':_c2}}}},
}
ATTRIBUTES:dict[str,Any]={"AWS::DynamoDB::Table":["Arn","StreamArn","TableName"]}
RULES:dict[str,Any]={"AWS::DynamoDB::Table":[[["PointInTimeRecoverySpecification"],"d",{"RecoveryPeriodInDays":["PointInTimeRecoveryEnabled"]}],[["WarmThroughput"],"a",[["ReadUnitsPerSecond"],["WriteUnitsPerSecond"]]],[["GlobalSecondaryIndexes","[]","WarmThroughput"],"a",[["ReadUnitsPerSecond"],["WriteUnitsPerSecond"]]]]}
Nested types (25)
These are defined above the properties in the generated module.
class TableOnDemandThroughput(TypedDict, closed=True):
'Sets the maximum number of read and write units for the specified on-demand table.'
MaxReadRequestUnits: NotRequired[Expr[int]]
'Maximum number of read request units for the specified table.'
MaxWriteRequestUnits: NotRequired[Expr[int]]
'Maximum number of write request units for the specified table.'
class TableSSESpecification(TypedDict, closed=True):
'Represents the settings used to enable server-side encryption.'
SSEEnabled: Expr[bool]
'Indicates whether server-side encryption is done using an AWS managed key or an AWS owned key.'
SSEType: NotRequired[Expr[str]]
'Server-side encryption type.'
KMSMasterKeyId: NotRequired[Expr[str]]
'The KMS key that should be used for the KMS encryption.'
class TableKinesisStreamSpecification(TypedDict, closed=True):
'The Kinesis Data Streams configuration for the specified table.'
ApproximateCreationDateTimePrecision: NotRequired[Expr[str]]
'The precision for the time and date that the stream was created.'
StreamArn: Expr[str]
'The ARN for a specific Kinesis data stream.'
class TableResourcePolicy(TypedDict, closed=True):
'Creates or updates a resource-based policy document that contains the permissions for DDB resources, such as a table, its indexes, and stream.'
PolicyDocument: Expr[Mapping[str, Any]]
'A resource-based policy document that contains permissions to add to the specified DDB table, index, or both.'
class TableStreamSpecification(TypedDict, closed=True):
'Represents the DynamoDB Streams configuration for a table in DynamoDB.'
StreamViewType: Expr[str]
'When an item in the table is modified, ``StreamViewType`` determines what information is written to the stream for this table.'
ResourcePolicy: NotRequired[Expr[TableResourcePolicy]]
"Creates or updates a resource-based policy document that contains the permissions for DDB resources, such as a table's streams."
Tags: NotRequired[Expr[Sequence[Expr[Tag]]]]
'Specifies the tags to apply to the DDB stream.'
class TableContributorInsightsSpecification(TypedDict, closed=True):
'Configures contributor insights settings for a table or one of its indexes.'
Mode: NotRequired[Expr[str]]
'Specifies the CloudWatch Contributor Insights mode for a table.'
Enabled: Expr[bool]
'Indicates whether CloudWatch Contributor Insights are to be enabled (true) or disabled (false).'
class TableS3BucketSource(TypedDict, closed=True):
'The S3 bucket that is being imported from.'
S3Bucket: Expr[str]
'The S3 bucket that is being imported from.'
S3KeyPrefix: NotRequired[Expr[str]]
'The key prefix shared by all S3 Objects that are being imported.'
S3BucketOwner: NotRequired[Expr[str]]
'The account number of the S3 bucket that is being imported from.'
class TableCsv(TypedDict, closed=True):
'The options for imported source files in CSV format.'
Delimiter: NotRequired[Expr[str]]
'The delimiter used for separating items in the CSV file being imported.'
HeaderList: NotRequired[Expr[list[Expr[str]]]]
'List of the headers used to specify a common header for all source CSV files being imported.'
class TableInputFormatOptions(TypedDict, closed=True):
'The format options for the data that was imported into the target table.'
Csv: NotRequired[Expr[TableCsv]]
'The options for imported source files in CSV format.'
class TableImportSourceSpecification(TypedDict, closed=True):
'Specifies the properties of data being imported from the S3 bucket source to the table.'
S3BucketSource: Expr[TableS3BucketSource]
'The S3 bucket that provides the source for the import.'
InputFormat: Expr[str]
'The format of the source data.'
InputFormatOptions: NotRequired[Expr[TableInputFormatOptions]]
'Additional properties that specify how the input is formatted,'
InputCompressionType: NotRequired[Expr[str]]
'Type of compression to be used on the input coming from the imported table.'
class TablePointInTimeRecoverySpecification(TypedDict, closed=True):
'The settings used to enable point in time recovery.'
PointInTimeRecoveryEnabled: NotRequired[Expr[bool]]
'Indicates whether point in time recovery is enabled (true) or disabled (false) on the table.'
RecoveryPeriodInDays: NotRequired[Expr[int]]
'The number of preceding days for which continuous backups are taken and maintained.'
class TableProvisionedThroughput(TypedDict, closed=True):
'Throughput for the specified table, which consists of values for ``ReadCapacityUnits`` and ``WriteCapacityUnits``.'
WriteCapacityUnits: Expr[int]
'The maximum number of writes consumed per second before DynamoDB returns a ``ThrottlingException``.'
ReadCapacityUnits: Expr[int]
'The maximum number of strongly consistent reads consumed per second before DynamoDB returns a ``ThrottlingException``.'
class TableWarmThroughput(TypedDict, closed=True):
'Provides visibility into the number of read and write operations your table or secondary index can instantaneously support.'
ReadUnitsPerSecond: NotRequired[Expr[int]]
'Represents the number of read operations your base table can instantaneously support.'
WriteUnitsPerSecond: NotRequired[Expr[int]]
'Represents the number of write operations your base table can instantaneously support.'
class TableVectorAttribute(TypedDict, closed=True):
AttributeName: Expr[str]
class TableProjection(TypedDict, closed=True):
'Represents attributes that are copied (projected) from the table into an index.'
NonKeyAttributes: NotRequired[Expr[list[Expr[str]]]]
'Represents the non-key attribute names which will be projected into the index.'
ProjectionType: NotRequired[Expr[str]]
'The set of attributes that are projected into the index: + ``KEYS_ONLY`` - Only the index and primary keys are projected into the index.'
class TableSearchSchemaElement(TypedDict, closed=True):
AttributeName: Expr[str]
SearchSchemaElementType: Expr[str]
class TableVectorIndex(TypedDict, closed=True):
IndexName: Expr[str]
VectorAttribute: Expr[TableVectorAttribute]
Projection: Expr[TableProjection]
Dimensions: Expr[int]
SearchSchema: NotRequired[Expr[Sequence[Expr[TableSearchSchemaElement]]]]
DistanceFunction: Expr[str]
class TableAttributeDefinition(TypedDict, closed=True):
'Represents an attribute for describing the schema for the table and indexes.'
AttributeType: Expr[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 typ...'
AttributeName: Expr[str]
'A name for the attribute.'
class TableKeySchema(TypedDict, closed=True):
'Represents *a single element* of a key schema.'
KeyType: Expr[str]
'The role that this key attribute will assume: + ``HASH`` - partition key + ``RANGE`` - sort key The partition key of an item is also known as its *hash attri...'
AttributeName: Expr[str]
'The name of a key attribute.'
class TableGlobalSecondaryIndex(TypedDict, closed=True):
'Represents the properties of a global secondary index.'
IndexName: Expr[str]
'The name of the global secondary index.'
OnDemandThroughput: NotRequired[Expr[TableOnDemandThroughput]]
'The maximum number of read and write units for the specified global secondary index.'
ContributorInsightsSpecification: NotRequired[Expr[TableContributorInsightsSpecification]]
'The settings used to specify whether to enable CloudWatch Contributor Insights for the global table and define which events to monitor.'
Projection: Expr[TableProjection]
'Represents attributes that are copied (projected) from the table into the global secondary index.'
ProvisionedThroughput: NotRequired[Expr[TableProvisionedThroughput]]
'Represents the provisioned throughput settings for the specified global secondary index.'
KeySchema: Expr[Sequence[Expr[TableKeySchema]]]
'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 + ``RA...'
WarmThroughput: NotRequired[Expr[TableWarmThroughput]]
'Represents the warm throughput value (in read units per second and write units per second) for the specified secondary index.'
class TableLocalSecondaryIndex(TypedDict, closed=True):
'Represents the properties of a local secondary index.'
IndexName: Expr[str]
'The name of the local secondary index.'
Projection: Expr[TableProjection]
'Represents attributes that are copied (projected) from the table into the local secondary index.'
KeySchema: Expr[Sequence[Expr[TableKeySchema]]]
'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...'
class TableTimeToLiveSpecification(TypedDict, closed=True):
'Represents the settings used to enable or disable Time to Live (TTL) for the specified table.'
Enabled: Expr[bool]
'Indicates whether TTL is to be enabled (true) or disabled (false) on the table.'
AttributeName: NotRequired[Expr[str]]
'The name of the TTL attribute used to store the expiration time for items in the table.'
class TableProps(TypedDict, closed=True):
'The ``AWS::DynamoDB::Table`` resource creates a DDB table.'
OnDemandThroughput: NotRequired[Expr[TableOnDemandThroughput]]
'Sets the maximum number of read and write units for the specified on-demand table.'
SSESpecification: NotRequired[Expr[TableSSESpecification]]
'Specifies the settings to enable server-side encryption.'
KinesisStreamSpecification: NotRequired[Expr[TableKinesisStreamSpecification]]
'The Kinesis Data Streams configuration for the specified table.'
StreamSpecification: NotRequired[Expr[TableStreamSpecification]]
'The settings for the DDB table stream, which captures changes to items stored in the table.'
ContributorInsightsSpecification: NotRequired[Expr[TableContributorInsightsSpecification]]
'The settings used to specify whether to enable CloudWatch Contributor Insights for the table and define which events to monitor.'
ImportSourceSpecification: NotRequired[Expr[TableImportSourceSpecification]]
'Specifies the properties of data being imported from the S3 bucket source to the" table.'
PointInTimeRecoverySpecification: NotRequired[Expr[TablePointInTimeRecoverySpecification]]
'The settings used to enable point in time recovery.'
ProvisionedThroughput: NotRequired[Expr[TableProvisionedThroughput]]
'Throughput for the specified table, which consists of values for ``ReadCapacityUnits`` and ``WriteCapacityUnits``.'
WarmThroughput: NotRequired[Expr[TableWarmThroughput]]
'Represents the warm throughput (in read units per second and write units per second) for creating a table.'
VectorIndexes: NotRequired[Expr[Sequence[Expr[TableVectorIndex]]]]
TableName: NotRequired[Expr[str]]
'A name for the table.'
AttributeDefinitions: NotRequired[Expr[Sequence[Expr[TableAttributeDefinition]]]]
'A list of attributes that describe the key schema for the table and indexes.'
GlobalSecondaryIndexes: NotRequired[Expr[Sequence[Expr[TableGlobalSecondaryIndex]]]]
'Global secondary indexes to be created on the table.'
BillingMode: NotRequired[Expr[str]]
'Specify how you are charged for read and write throughput and how you manage capacity.'
ResourcePolicy: NotRequired[Expr[TableResourcePolicy]]
'An AWS resource-based policy document in JSON format that will be attached to the table.'
LocalSecondaryIndexes: NotRequired[Expr[Sequence[Expr[TableLocalSecondaryIndex]]]]
'Local secondary indexes to be created on the table.'
KeySchema: Expr[Sequence[Expr[TableKeySchema]]] | Expr[Mapping[str, Any]]
'Specifies the attributes that make up the primary key for the table.'
DeletionProtectionEnabled: NotRequired[Expr[bool]]
'Determines if a table is protected from deletion.'
TableClass: NotRequired[Expr[str]]
'The table class of the new table.'
Tags: NotRequired[Expr[Sequence[Expr[Tag]]]]
'An array of key-value pairs to apply to this resource.'
TimeToLiveSpecification: NotRequired[Expr[TableTimeToLiveSpecification]]
'Specifies the Time to Live (TTL) settings for the table.'
class Table(ResourceAttrs):
'The ``AWS::DynamoDB::Table`` resource creates a DDB table.'
Type: Literal['AWS::DynamoDB::Table']
Properties: TableProps
def table(
*,
depends_on: DependsOn | None = None,
deletion_policy: DeletionPolicy | None = None,
update_replace_policy: UpdateReplacePolicy | None = None,
condition: str | None = None,
metadata: dict[str, Any] | None = None,
**props: Unpack[TableProps],
) -> Table:
return build('AWS::DynamoDB::Table', props, depends_on, deletion_policy, update_replace_policy, condition, metadata)
Attributes¶
Read-only values for get_att(logical_id, attribute). They are not accepted as inputs.
ArnStreamArn