Table Replica
Provides a DynamoDB table replica resource for DynamoDB Global Tables V2 (version 2019.11.21).
Note: Use
lifecycle
ignore_changes
forreplica
in the associated aws.dynamodb.Table configuration. Note: Do not use thereplica
configuration block of aws.dynamodb.Table together with this resource as the two configuration options are mutually exclusive.
Example Usage
Basic Example
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const example = new aws.dynamodb.Table("example", {
name: "TestTable",
hashKey: "BrodoBaggins",
billingMode: "PAY_PER_REQUEST",
streamEnabled: true,
streamViewType: "NEW_AND_OLD_IMAGES",
attributes: [{
name: "BrodoBaggins",
type: "S",
}],
});
const exampleTableReplica = new aws.dynamodb.TableReplica("example", {
globalTableArn: example.arn,
tags: {
Name: "IZPAWS",
Pozo: "Amargo",
},
});
import pulumi
import pulumi_aws as aws
example = aws.dynamodb.Table("example",
name="TestTable",
hash_key="BrodoBaggins",
billing_mode="PAY_PER_REQUEST",
stream_enabled=True,
stream_view_type="NEW_AND_OLD_IMAGES",
attributes=[{
"name": "BrodoBaggins",
"type": "S",
}])
example_table_replica = aws.dynamodb.TableReplica("example",
global_table_arn=example.arn,
tags={
"Name": "IZPAWS",
"Pozo": "Amargo",
})
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var example = new Aws.DynamoDB.Table("example", new()
{
Name = "TestTable",
HashKey = "BrodoBaggins",
BillingMode = "PAY_PER_REQUEST",
StreamEnabled = true,
StreamViewType = "NEW_AND_OLD_IMAGES",
Attributes = new[]
{
new Aws.DynamoDB.Inputs.TableAttributeArgs
{
Name = "BrodoBaggins",
Type = "S",
},
},
});
var exampleTableReplica = new Aws.DynamoDB.TableReplica("example", new()
{
GlobalTableArn = example.Arn,
Tags =
{
{ "Name", "IZPAWS" },
{ "Pozo", "Amargo" },
},
});
});
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/dynamodb"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
example, err := dynamodb.NewTable(ctx, "example", &dynamodb.TableArgs{
Name: pulumi.String("TestTable"),
HashKey: pulumi.String("BrodoBaggins"),
BillingMode: pulumi.String("PAY_PER_REQUEST"),
StreamEnabled: pulumi.Bool(true),
StreamViewType: pulumi.String("NEW_AND_OLD_IMAGES"),
Attributes: dynamodb.TableAttributeArray{
&dynamodb.TableAttributeArgs{
Name: pulumi.String("BrodoBaggins"),
Type: pulumi.String("S"),
},
},
})
if err != nil {
return err
}
_, err = dynamodb.NewTableReplica(ctx, "example", &dynamodb.TableReplicaArgs{
GlobalTableArn: example.Arn,
Tags: pulumi.StringMap{
"Name": pulumi.String("IZPAWS"),
"Pozo": pulumi.String("Amargo"),
},
})
if err != nil {
return err
}
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.dynamodb.Table;
import com.pulumi.aws.dynamodb.TableArgs;
import com.pulumi.aws.dynamodb.inputs.TableAttributeArgs;
import com.pulumi.aws.dynamodb.TableReplica;
import com.pulumi.aws.dynamodb.TableReplicaArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var example = new Table("example", TableArgs.builder()
.name("TestTable")
.hashKey("BrodoBaggins")
.billingMode("PAY_PER_REQUEST")
.streamEnabled(true)
.streamViewType("NEW_AND_OLD_IMAGES")
.attributes(TableAttributeArgs.builder()
.name("BrodoBaggins")
.type("S")
.build())
.build());
var exampleTableReplica = new TableReplica("exampleTableReplica", TableReplicaArgs.builder()
.globalTableArn(example.arn())
.tags(Map.ofEntries(
Map.entry("Name", "IZPAWS"),
Map.entry("Pozo", "Amargo")
))
.build());
}
}
resources:
example:
type: aws:dynamodb:Table
properties:
name: TestTable
hashKey: BrodoBaggins
billingMode: PAY_PER_REQUEST
streamEnabled: true
streamViewType: NEW_AND_OLD_IMAGES
attributes:
- name: BrodoBaggins
type: S
exampleTableReplica:
type: aws:dynamodb:TableReplica
name: example
properties:
globalTableArn: ${example.arn}
tags:
Name: IZPAWS
Pozo: Amargo
Import
Using pulumi import
, import DynamoDB table replicas using the table-name:main-region
. For example: ~>Note: When importing, use the region where the initial or main global table resides, not the region of the replica.
$ pulumi import aws:dynamodb/tableReplica:TableReplica example TestTable:us-west-2
Properties
Whether deletion protection is enabled (true) or disabled (false) on the table replica.
ARN of the main or global table which this resource will replicate. Optional arguments:
Whether to enable Point In Time Recovery for the table replica. Default is false
.
Storage class of the table replica. Valid values are STANDARD
and STANDARD_INFREQUENT_ACCESS
. If not used, the table replica will use the same class as the global table.