GlobalTable

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 aws.dynamodb.Table 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

using Pulumi;
using Aws = Pulumi.Aws;

class MyStack : Stack
{
    public MyStack()
    {
        var us_east_1 = new Aws.Provider("us-east-1", new Aws.ProviderArgs
        {
            Region = "us-east-1",
        });
        var us_west_2 = new Aws.Provider("us-west-2", new Aws.ProviderArgs
        {
            Region = "us-west-2",
        });
        var us_east_1Table = new Aws.DynamoDB.Table("us-east-1Table", new Aws.DynamoDB.TableArgs
        {
            Attributes = 
            {
                new Aws.DynamoDB.Inputs.TableAttributeArgs
                {
                    Name = "myAttribute",
                    Type = "S",
                },
            },
            HashKey = "myAttribute",
            ReadCapacity = 1,
            StreamEnabled = true,
            StreamViewType = "NEW_AND_OLD_IMAGES",
            WriteCapacity = 1,
        }, new CustomResourceOptions
        {
            Provider = "aws.us-east-1",
        });
        var us_west_2Table = new Aws.DynamoDB.Table("us-west-2Table", new Aws.DynamoDB.TableArgs
        {
            Attributes = 
            {
                new Aws.DynamoDB.Inputs.TableAttributeArgs
                {
                    Name = "myAttribute",
                    Type = "S",
                },
            },
            HashKey = "myAttribute",
            ReadCapacity = 1,
            StreamEnabled = true,
            StreamViewType = "NEW_AND_OLD_IMAGES",
            WriteCapacity = 1,
        }, new CustomResourceOptions
        {
            Provider = "aws.us-west-2",
        });
        var myTable = new Aws.DynamoDB.GlobalTable("myTable", new Aws.DynamoDB.GlobalTableArgs
        {
            Replicas = 
            {
                new Aws.DynamoDB.Inputs.GlobalTableReplicaArgs
                {
                    RegionName = "us-east-1",
                },
                new Aws.DynamoDB.Inputs.GlobalTableReplicaArgs
                {
                    RegionName = "us-west-2",
                },
            },
        }, new CustomResourceOptions
        {
            Provider = "aws.us-east-1",
            DependsOn = 
            {
                "aws_dynamodb_table.us-east-1",
                "aws_dynamodb_table.us-west-2",
            },
        });
    }

}
package main

import (
    "github.com/pulumi/pulumi-aws/sdk/v2/go/aws/dynamodb"
    "github.com/pulumi/pulumi-aws/sdk/v2/go/aws/providers"
    "github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)

func main() {
    pulumi.Run(func(ctx *pulumi.Context) error {
        _, err := providers.Newaws(ctx, "us_east_1", &providers.awsArgs{
            Region: pulumi.String("us-east-1"),
        })
        if err != nil {
            return err
        }
        _, err = providers.Newaws(ctx, "us_west_2", &providers.awsArgs{
            Region: pulumi.String("us-west-2"),
        })
        if err != nil {
            return err
        }
        _, err = dynamodb.NewTable(ctx, "us_east_1Table", &dynamodb.TableArgs{
            Attributes: dynamodb.TableAttributeArray{
                &dynamodb.TableAttributeArgs{
                    Name: pulumi.String("myAttribute"),
                    Type: pulumi.String("S"),
                },
            },
            HashKey:        pulumi.String("myAttribute"),
            ReadCapacity:   pulumi.Int(1),
            StreamEnabled:  pulumi.Bool(true),
            StreamViewType: pulumi.String("NEW_AND_OLD_IMAGES"),
            WriteCapacity:  pulumi.Int(1),
        }, pulumi.Provider("aws.us-east-1"))
        if err != nil {
            return err
        }
        _, err = dynamodb.NewTable(ctx, "us_west_2Table", &dynamodb.TableArgs{
            Attributes: dynamodb.TableAttributeArray{
                &dynamodb.TableAttributeArgs{
                    Name: pulumi.String("myAttribute"),
                    Type: pulumi.String("S"),
                },
            },
            HashKey:        pulumi.String("myAttribute"),
            ReadCapacity:   pulumi.Int(1),
            StreamEnabled:  pulumi.Bool(true),
            StreamViewType: pulumi.String("NEW_AND_OLD_IMAGES"),
            WriteCapacity:  pulumi.Int(1),
        }, pulumi.Provider("aws.us-west-2"))
        if err != nil {
            return err
        }
        _, err = dynamodb.NewGlobalTable(ctx, "myTable", &dynamodb.GlobalTableArgs{
            Replicas: dynamodb.GlobalTableReplicaArray{
                &dynamodb.GlobalTableReplicaArgs{
                    RegionName: pulumi.String("us-east-1"),
                },
                &dynamodb.GlobalTableReplicaArgs{
                    RegionName: pulumi.String("us-west-2"),
                },
            },
        }, pulumi.Provider("aws.us-east-1"), pulumi.DependsOn([]pulumi.Resource{
            "aws_dynamodb_table.us-east-1",
            "aws_dynamodb_table.us-west-2",
        }))
        if err != nil {
            return err
        }
        return nil
    })
}
import pulumi
import pulumi_aws as aws
import pulumi_pulumi as pulumi

us_east_1 = pulumi.providers.Aws("us-east-1", region="us-east-1")
us_west_2 = pulumi.providers.Aws("us-west-2", region="us-west-2")
us_east_1_table = aws.dynamodb.Table("us-east-1Table",
    attributes=[{
        "name": "myAttribute",
        "type": "S",
    }],
    hash_key="myAttribute",
    read_capacity=1,
    stream_enabled=True,
    stream_view_type="NEW_AND_OLD_IMAGES",
    write_capacity=1,
    opts=ResourceOptions(provider="aws.us-east-1"))
us_west_2_table = aws.dynamodb.Table("us-west-2Table",
    attributes=[{
        "name": "myAttribute",
        "type": "S",
    }],
    hash_key="myAttribute",
    read_capacity=1,
    stream_enabled=True,
    stream_view_type="NEW_AND_OLD_IMAGES",
    write_capacity=1,
    opts=ResourceOptions(provider="aws.us-west-2"))
my_table = aws.dynamodb.GlobalTable("myTable", replicas=[
    {
        "regionName": "us-east-1",
    },
    {
        "regionName": "us-west-2",
    },
],
opts=ResourceOptions(provider="aws.us-east-1",
    depends_on=[
        "aws_dynamodb_table.us-east-1",
        "aws_dynamodb_table.us-west-2",
    ]))
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const us_east_1 = new aws.Provider("us-east-1", {
    region: "us-east-1",
});
const us_west_2 = new aws.Provider("us-west-2", {
    region: "us-west-2",
});
const us_east_1Table = new aws.dynamodb.Table("us-east-1", {
    attributes: [{
        name: "myAttribute",
        type: "S",
    }],
    hashKey: "myAttribute",
    readCapacity: 1,
    streamEnabled: true,
    streamViewType: "NEW_AND_OLD_IMAGES",
    writeCapacity: 1,
}, { provider: us_east_1 });
const us_west_2Table = new aws.dynamodb.Table("us-west-2", {
    attributes: [{
        name: "myAttribute",
        type: "S",
    }],
    hashKey: "myAttribute",
    readCapacity: 1,
    streamEnabled: true,
    streamViewType: "NEW_AND_OLD_IMAGES",
    writeCapacity: 1,
}, { provider: us_west_2 });
const myTable = new aws.dynamodb.GlobalTable("myTable", {
    replicas: [
        {
            regionName: "us-east-1",
        },
        {
            regionName: "us-west-2",
        },
    ],
}, { provider: us_east_1, dependsOn: [us_east_1Table, us_west_2Table] });

Create a GlobalTable Resource

def GlobalTable(resource_name, opts=None, name=None, replicas=None, __props__=None);
func NewGlobalTable(ctx *Context, name string, args GlobalTableArgs, opts ...ResourceOption) (*GlobalTable, error)
public GlobalTable(string name, GlobalTableArgs args, CustomResourceOptions? opts = null)
name string
The unique name of the resource.
args GlobalTableArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name str
The unique name of the resource.
opts ResourceOptions
A bag of options that control this resource's behavior.
ctx Context
Context object for the current deployment.
name string
The unique name of the resource.
args GlobalTableArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args GlobalTableArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.

GlobalTable Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Programming Model docs.

Inputs

The GlobalTable resource accepts the following input properties:

Replicas List<GlobalTableReplicaArgs>

Underlying DynamoDB Table. At least 1 replica must be defined. See below.

Name string

The name of the global table. Must match underlying DynamoDB Table names in all regions.

Replicas []GlobalTableReplica

Underlying DynamoDB Table. At least 1 replica must be defined. See below.

Name string

The name of the global table. Must match underlying DynamoDB Table names in all regions.

replicas GlobalTableReplica[]

Underlying DynamoDB Table. At least 1 replica must be defined. See below.

name string

The name of the global table. Must match underlying DynamoDB Table names in all regions.

replicas List[GlobalTableReplica]

Underlying DynamoDB Table. At least 1 replica must be defined. See below.

name str

The name of the global table. Must match underlying DynamoDB Table names in all regions.

Outputs

All input properties are implicitly available as output properties. Additionally, the GlobalTable resource produces the following output properties:

Arn string

The ARN of the DynamoDB Global Table

Id string
The provider-assigned unique ID for this managed resource.
Arn string

The ARN of the DynamoDB Global Table

Id string
The provider-assigned unique ID for this managed resource.
arn string

The ARN of the DynamoDB Global Table

id string
The provider-assigned unique ID for this managed resource.
arn str

The ARN of the DynamoDB Global Table

id str
The provider-assigned unique ID for this managed resource.

Look up an Existing GlobalTable Resource

Get an existing GlobalTable resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: GlobalTableState, opts?: CustomResourceOptions): GlobalTable
static get(resource_name, id, opts=None, arn=None, name=None, replicas=None, __props__=None);
func GetGlobalTable(ctx *Context, name string, id IDInput, state *GlobalTableState, opts ...ResourceOption) (*GlobalTable, error)
public static GlobalTable Get(string name, Input<string> id, GlobalTableState? state, CustomResourceOptions? opts = null)
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.

The following state arguments are supported:

Arn string

The ARN of the DynamoDB Global Table

Name string

The name of the global table. Must match underlying DynamoDB Table names in all regions.

Replicas List<GlobalTableReplicaArgs>

Underlying DynamoDB Table. At least 1 replica must be defined. See below.

Arn string

The ARN of the DynamoDB Global Table

Name string

The name of the global table. Must match underlying DynamoDB Table names in all regions.

Replicas []GlobalTableReplica

Underlying DynamoDB Table. At least 1 replica must be defined. See below.

arn string

The ARN of the DynamoDB Global Table

name string

The name of the global table. Must match underlying DynamoDB Table names in all regions.

replicas GlobalTableReplica[]

Underlying DynamoDB Table. At least 1 replica must be defined. See below.

arn str

The ARN of the DynamoDB Global Table

name str

The name of the global table. Must match underlying DynamoDB Table names in all regions.

replicas List[GlobalTableReplica]

Underlying DynamoDB Table. At least 1 replica must be defined. See below.

Supporting Types

GlobalTableReplica

See the input and output API doc for this type.

See the input and output API doc for this type.

See the input and output API doc for this type.

RegionName string

AWS region name of replica DynamoDB Table. e.g. us-east-1

RegionName string

AWS region name of replica DynamoDB Table. e.g. us-east-1

regionName string

AWS region name of replica DynamoDB Table. e.g. us-east-1

regionName str

AWS region name of replica DynamoDB Table. e.g. us-east-1

Package Details

Repository
https://github.com/pulumi/pulumi-aws
License
Apache-2.0
Notes
This Pulumi package is based on the aws Terraform Provider.