Resource: awsDynamodbGlobalTable
Manages DynamoDB Global Tables V1 (version 2017.11.29). These are layered on top of existing DynamoDB Tables.
\~> NOTE: To instead manage DynamoDB Global Tables V2 (version 2019.11.21), use the awsDynamodbTable
resource replica
configuration block.
\~> Note: There are many restrictions before you can properly create DynamoDB Global Tables in multiple regions. See the AWS DynamoDB Global Table Requirements for more information.
Example Usage
/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as aws from "./.gen/providers/aws";
const awsUsEast1 = new aws.provider.AwsProvider(this, "aws", {
alias: "us-east-1",
region: "us-east-1",
});
const awsUsWest2 = new aws.provider.AwsProvider(this, "aws_1", {
alias: "us-west-2",
region: "us-west-2",
});
const awsDynamodbTableUsEast1 = new aws.dynamodbTable.DynamodbTable(
this,
"us-east-1",
{
attribute: [
{
name: "myAttribute",
type: "S",
},
],
hashKey: "myAttribute",
name: "myTable",
provider: `\${${awsUsEast1.fqn}}`,
readCapacity: 1,
streamEnabled: true,
streamViewType: "NEW_AND_OLD_IMAGES",
writeCapacity: 1,
}
);
const awsDynamodbTableUsWest2 = new aws.dynamodbTable.DynamodbTable(
this,
"us-west-2",
{
attribute: [
{
name: "myAttribute",
type: "S",
},
],
hashKey: "myAttribute",
name: "myTable",
provider: `\${${awsUsWest2.fqn}}`,
readCapacity: 1,
streamEnabled: true,
streamViewType: "NEW_AND_OLD_IMAGES",
writeCapacity: 1,
}
);
new aws.dynamodbGlobalTable.DynamodbGlobalTable(this, "myTable", {
depends_on: [
`\${${awsDynamodbTableUsEast1.fqn}}`,
`\${${awsDynamodbTableUsWest2.fqn}}`,
],
name: "myTable",
provider: `\${${awsUsEast1.fqn}}`,
replica: [
{
regionName: "us-east-1",
},
{
regionName: "us-west-2",
},
],
});
Argument Reference
The following arguments are supported:
name
- (Required) The name of the global table. Must match underlying DynamoDB Table names in all regions.replica
- (Required) Underlying DynamoDB Table. At least 1 replica must be defined. See below.
Nested Fields
replica
regionName
- (Required) AWS region name of replica DynamoDB TableE.g.,usEast1
Attributes Reference
In addition to all arguments above, the following attributes are exported:
id
- The name of the DynamoDB Global Tablearn
- The ARN of the DynamoDB Global Table
Import
DynamoDB Global Tables can be imported using the global table name, e.g.,