AttributeType

class aws_cdk.aws_dynamodb.AttributeType(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: Enum

Data types for attributes within a table.

See:

https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/HowItWorks.NamingRulesDataTypes.html#HowItWorks.DataTypes

ExampleMetadata:

infused

Example:

import aws_cdk as cdk


app = cdk.App()
stack = cdk.Stack(app, "Stack", env=cdk.Environment(region="us-west-2"))

global_table = dynamodb.TableV2(stack, "GlobalTable",
    partition_key=dynamodb.Attribute(name="pk", type=dynamodb.AttributeType.STRING),
    # applys to all replicas, i.e., us-west-2, us-east-1, us-east-2
    removal_policy=cdk.RemovalPolicy.DESTROY,
    replicas=[dynamodb.ReplicaTableProps(region="us-east-1"), dynamodb.ReplicaTableProps(region="us-east-2")
    ]
)

Attributes

BINARY

Up to 400KiB of binary data (which must be encoded as base64 before sending to DynamoDB).

NUMBER

Numeric values made of up to 38 digits (positive, negative or zero).

STRING

Up to 400KiB of UTF-8 encoded text.