Skip to content
v2.278.0

AttributeType Enum ​

Data types for attributes within a table.

Example ​

ts
import * as cdk from 'aws-cdk-lib';

const app = new cdk.App();

// Source table in Account A
const sourceStack = new cdk.Stack(app, 'SourceStack', {
  env: { region: 'us-east-1', account: '111111111111' },
});

// Region us-west-2
const sourceTable = new dynamodb.TableV2(sourceStack, 'SourceTable', {
  tableName: 'MyMultiAccountTable',
  partitionKey: { name: 'pk', type: dynamodb.AttributeType.STRING },
  globalTableSettingsReplicationMode: dynamodb.GlobalTableSettingsReplicationMode.ALL,
});
// After replica is deployed, update source stack with the ARN
sourceTable.grants.multiAccountReplicationTo('arn:aws:dynamodb:us-east-1:222222222222:table/MyMultiAccountTable');
python
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")
java
import software.amazon.awscdk.*;


App app = new App();

// Source table in Account A
Stack sourceStack = Stack.Builder.create(app, "SourceStack")
        .env(Environment.builder().region("us-east-1").account("111111111111").build())
        .build();

// Region us-west-2
TableV2 sourceTable = TableV2.Builder.create(sourceStack, "SourceTable")
        .tableName("MyMultiAccountTable")
        .partitionKey(Attribute.builder().name("pk").type(AttributeType.STRING).build())
        .globalTableSettingsReplicationMode(GlobalTableSettingsReplicationMode.ALL)
        .build();
// After replica is deployed, update source stack with the ARN
sourceTable.grants.multiAccountReplicationTo("arn:aws:dynamodb:us-east-1:222222222222:table/MyMultiAccountTable");
csharp
// Install: dotnet add package Amazon.CDK.Lib
using Amazon.CDK;


var app = new App();

// Source table in Account A
var sourceStack = new Stack(app, "SourceStack", new StackProps {
    Env = new Environment { Region = "us-east-1", Account = "111111111111" }
});

// Region us-west-2
var sourceTable = new TableV2(sourceStack, "SourceTable", new TablePropsV2 {
    TableName = "MyMultiAccountTable",
    PartitionKey = new Attribute { Name = "pk", Type = AttributeType.STRING },
    GlobalTableSettingsReplicationMode = GlobalTableSettingsReplicationMode.ALL
});
// After replica is deployed, update source stack with the ARN
sourceTable.Grants.MultiAccountReplicationTo("arn:aws:dynamodb:us-east-1:222222222222:table/MyMultiAccountTable");
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
import "github.com/aws/aws-cdk-go/awscdk"


app := cdk.NewApp()

// Source table in Account A
sourceStack := cdk.NewStack(app, jsii.String("SourceStack"), &StackProps{
	Env: &Environment{
		Region: jsii.String("us-east-1"),
		Account: jsii.String("111111111111"),
	},
})

// Region us-west-2
sourceTable := dynamodb.NewTableV2(sourceStack, jsii.String("SourceTable"), &TablePropsV2{
	TableName: jsii.String("MyMultiAccountTable"),
	PartitionKey: &Attribute{
		Name: jsii.String("pk"),
		Type: dynamodb.AttributeType_STRING,
	},
	GlobalTableSettingsReplicationMode: dynamodb.GlobalTableSettingsReplicationMode_ALL,
})
// After replica is deployed, update source stack with the ARN
sourceTable.Grants.MultiAccountReplicationTo(jsii.String("arn:aws:dynamodb:us-east-1:222222222222:table/MyMultiAccountTable"))

Members ​

MemberDescription
BINARYUp to 400KiB of binary data (which must be encoded as base64 before sending to DynamoDB).
NUMBERNumeric values made of up to 38 digits (positive, negative or zero).
STRINGUp to 400KiB of UTF-8 encoded text.

Referenced by ​