Attribute

class aws_cdk.aws_dynamodb.Attribute(*, name, type)

Bases: object

Represents an attribute for describing the key schema for the table and indexes.

Parameters:
  • name (str) – The name of an attribute.

  • type (AttributeType) – The data type of an attribute.

ExampleMetadata:

infused

Example:

import aws_cdk as cdk


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

mrsc_table = dynamodb.TableV2(stack, "MRSCTable",
    partition_key=dynamodb.Attribute(name="pk", type=dynamodb.AttributeType.STRING),
    multi_region_consistency=dynamodb.MultiRegionConsistency.STRONG,
    replicas=[dynamodb.ReplicaTableProps(region="us-east-1")
    ],
    witness_region="us-east-2"
)

Attributes

name

The name of an attribute.

type

The data type of an attribute.