Attribute
- class aws_cdk.aws_dynamodb.Attribute(*, name, type)
Bases:
objectRepresents 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() # Source table in Account A source_stack = cdk.Stack(app, "SourceStack", env=cdk.Environment(region="us-east-1", account="111111111111") ) # Region us-west-2 source_table = dynamodb.TableV2(source_stack, "SourceTable", table_name="MyMultiAccountTable", partition_key=dynamodb.Attribute(name="pk", type=dynamodb.AttributeType.STRING), global_table_settings_replication_mode=dynamodb.GlobalTableSettingsReplicationMode.ALL ) # After replica is deployed, update source stack with the ARN source_table.grants.multi_account_replication_to("arn:aws:dynamodb:us-east-1:222222222222:table/MyMultiAccountTable")
Attributes
- name
The name of an attribute.
- type
The data type of an attribute.