Try AWS Native preview for resources not in the classic version.
aws.dynamodb.GlobalTable
Explore with Pulumi AI
Try AWS Native preview for resources not in the classic version.
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
resourcereplica
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 System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var us_east_1 = new Aws.Provider("us-east-1", new()
{
Region = "us-east-1",
});
var us_west_2 = new Aws.Provider("us-west-2", new()
{
Region = "us-west-2",
});
var us_east_1Table = new Aws.DynamoDB.Table("us-east-1Table", new()
{
HashKey = "myAttribute",
StreamEnabled = true,
StreamViewType = "NEW_AND_OLD_IMAGES",
ReadCapacity = 1,
WriteCapacity = 1,
Attributes = new[]
{
new Aws.DynamoDB.Inputs.TableAttributeArgs
{
Name = "myAttribute",
Type = "S",
},
},
}, new CustomResourceOptions
{
Provider = aws.Us_east_1,
});
var us_west_2Table = new Aws.DynamoDB.Table("us-west-2Table", new()
{
HashKey = "myAttribute",
StreamEnabled = true,
StreamViewType = "NEW_AND_OLD_IMAGES",
ReadCapacity = 1,
WriteCapacity = 1,
Attributes = new[]
{
new Aws.DynamoDB.Inputs.TableAttributeArgs
{
Name = "myAttribute",
Type = "S",
},
},
}, new CustomResourceOptions
{
Provider = aws.Us_west_2,
});
var myTable = new Aws.DynamoDB.GlobalTable("myTable", new()
{
Replicas = new[]
{
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 = new[]
{
us_east_1Table,
us_west_2Table,
},
});
});
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v6/go/aws"
"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 {
_, err := aws.NewProvider(ctx, "us-east-1", &aws.ProviderArgs{
Region: pulumi.String("us-east-1"),
})
if err != nil {
return err
}
_, err = aws.NewProvider(ctx, "us-west-2", &aws.ProviderArgs{
Region: pulumi.String("us-west-2"),
})
if err != nil {
return err
}
_, err = dynamodb.NewTable(ctx, "us-east-1Table", &dynamodb.TableArgs{
HashKey: pulumi.String("myAttribute"),
StreamEnabled: pulumi.Bool(true),
StreamViewType: pulumi.String("NEW_AND_OLD_IMAGES"),
ReadCapacity: pulumi.Int(1),
WriteCapacity: pulumi.Int(1),
Attributes: dynamodb.TableAttributeArray{
&dynamodb.TableAttributeArgs{
Name: pulumi.String("myAttribute"),
Type: pulumi.String("S"),
},
},
}, pulumi.Provider(aws.UsEast1))
if err != nil {
return err
}
_, err = dynamodb.NewTable(ctx, "us-west-2Table", &dynamodb.TableArgs{
HashKey: pulumi.String("myAttribute"),
StreamEnabled: pulumi.Bool(true),
StreamViewType: pulumi.String("NEW_AND_OLD_IMAGES"),
ReadCapacity: pulumi.Int(1),
WriteCapacity: pulumi.Int(1),
Attributes: dynamodb.TableAttributeArray{
&dynamodb.TableAttributeArgs{
Name: pulumi.String("myAttribute"),
Type: pulumi.String("S"),
},
},
}, pulumi.Provider(aws.UsWest2))
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.UsEast1), pulumi.DependsOn([]pulumi.Resource{
us_east_1Table,
us_west_2Table,
}))
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.Provider;
import com.pulumi.aws.ProviderArgs;
import com.pulumi.aws.dynamodb.Table;
import com.pulumi.aws.dynamodb.TableArgs;
import com.pulumi.aws.dynamodb.inputs.TableAttributeArgs;
import com.pulumi.aws.dynamodb.GlobalTable;
import com.pulumi.aws.dynamodb.GlobalTableArgs;
import com.pulumi.aws.dynamodb.inputs.GlobalTableReplicaArgs;
import com.pulumi.resources.CustomResourceOptions;
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 us_east_1 = new Provider("us-east-1", ProviderArgs.builder()
.region("us-east-1")
.build());
var us_west_2 = new Provider("us-west-2", ProviderArgs.builder()
.region("us-west-2")
.build());
var us_east_1Table = new Table("us-east-1Table", TableArgs.builder()
.hashKey("myAttribute")
.streamEnabled(true)
.streamViewType("NEW_AND_OLD_IMAGES")
.readCapacity(1)
.writeCapacity(1)
.attributes(TableAttributeArgs.builder()
.name("myAttribute")
.type("S")
.build())
.build(), CustomResourceOptions.builder()
.provider(aws.us-east-1())
.build());
var us_west_2Table = new Table("us-west-2Table", TableArgs.builder()
.hashKey("myAttribute")
.streamEnabled(true)
.streamViewType("NEW_AND_OLD_IMAGES")
.readCapacity(1)
.writeCapacity(1)
.attributes(TableAttributeArgs.builder()
.name("myAttribute")
.type("S")
.build())
.build(), CustomResourceOptions.builder()
.provider(aws.us-west-2())
.build());
var myTable = new GlobalTable("myTable", GlobalTableArgs.builder()
.replicas(
GlobalTableReplicaArgs.builder()
.regionName("us-east-1")
.build(),
GlobalTableReplicaArgs.builder()
.regionName("us-west-2")
.build())
.build(), CustomResourceOptions.builder()
.provider(aws.us-east-1())
.dependsOn(
us_east_1Table,
us_west_2Table)
.build());
}
}
import pulumi
import pulumi_aws as aws
us_east_1 = aws.Provider("us-east-1", region="us-east-1")
us_west_2 = aws.Provider("us-west-2", region="us-west-2")
us_east_1_table = aws.dynamodb.Table("us-east-1Table",
hash_key="myAttribute",
stream_enabled=True,
stream_view_type="NEW_AND_OLD_IMAGES",
read_capacity=1,
write_capacity=1,
attributes=[aws.dynamodb.TableAttributeArgs(
name="myAttribute",
type="S",
)],
opts=pulumi.ResourceOptions(provider=aws["us-east-1"]))
us_west_2_table = aws.dynamodb.Table("us-west-2Table",
hash_key="myAttribute",
stream_enabled=True,
stream_view_type="NEW_AND_OLD_IMAGES",
read_capacity=1,
write_capacity=1,
attributes=[aws.dynamodb.TableAttributeArgs(
name="myAttribute",
type="S",
)],
opts=pulumi.ResourceOptions(provider=aws["us-west-2"]))
my_table = aws.dynamodb.GlobalTable("myTable", replicas=[
aws.dynamodb.GlobalTableReplicaArgs(
region_name="us-east-1",
),
aws.dynamodb.GlobalTableReplicaArgs(
region_name="us-west-2",
),
],
opts=pulumi.ResourceOptions(provider=aws["us-east-1"],
depends_on=[
us_east_1_table,
us_west_2_table,
]))
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-1Table", {
hashKey: "myAttribute",
streamEnabled: true,
streamViewType: "NEW_AND_OLD_IMAGES",
readCapacity: 1,
writeCapacity: 1,
attributes: [{
name: "myAttribute",
type: "S",
}],
}, {
provider: aws["us-east-1"],
});
const us_west_2Table = new aws.dynamodb.Table("us-west-2Table", {
hashKey: "myAttribute",
streamEnabled: true,
streamViewType: "NEW_AND_OLD_IMAGES",
readCapacity: 1,
writeCapacity: 1,
attributes: [{
name: "myAttribute",
type: "S",
}],
}, {
provider: aws["us-west-2"],
});
const myTable = new aws.dynamodb.GlobalTable("myTable", {replicas: [
{
regionName: "us-east-1",
},
{
regionName: "us-west-2",
},
]}, {
provider: aws["us-east-1"],
dependsOn: [
us_east_1Table,
us_west_2Table,
],
});
resources:
us-east-1:
type: pulumi:providers:aws
properties:
region: us-east-1
us-west-2:
type: pulumi:providers:aws
properties:
region: us-west-2
us-east-1Table:
type: aws:dynamodb:Table
properties:
hashKey: myAttribute
streamEnabled: true
streamViewType: NEW_AND_OLD_IMAGES
readCapacity: 1
writeCapacity: 1
attributes:
- name: myAttribute
type: S
options:
provider: ${aws"us-east-1"[%!s(MISSING)]}
us-west-2Table:
type: aws:dynamodb:Table
properties:
hashKey: myAttribute
streamEnabled: true
streamViewType: NEW_AND_OLD_IMAGES
readCapacity: 1
writeCapacity: 1
attributes:
- name: myAttribute
type: S
options:
provider: ${aws"us-west-2"[%!s(MISSING)]}
myTable:
type: aws:dynamodb:GlobalTable
properties:
replicas:
- regionName: us-east-1
- regionName: us-west-2
options:
provider: ${aws"us-east-1"[%!s(MISSING)]}
dependson:
- ${["us-east-1Table"]}
- ${["us-west-2Table"]}
Create GlobalTable Resource
new GlobalTable(name: string, args: GlobalTableArgs, opts?: CustomResourceOptions);
@overload
def GlobalTable(resource_name: str,
opts: Optional[ResourceOptions] = None,
name: Optional[str] = None,
replicas: Optional[Sequence[GlobalTableReplicaArgs]] = None)
@overload
def GlobalTable(resource_name: str,
args: GlobalTableArgs,
opts: Optional[ResourceOptions] = None)
func NewGlobalTable(ctx *Context, name string, args GlobalTableArgs, opts ...ResourceOption) (*GlobalTable, error)
public GlobalTable(string name, GlobalTableArgs args, CustomResourceOptions? opts = null)
public GlobalTable(String name, GlobalTableArgs args)
public GlobalTable(String name, GlobalTableArgs args, CustomResourceOptions options)
type: aws:dynamodb:GlobalTable
properties: # The arguments to resource properties.
options: # 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.
- resource_name str
- The unique name of the resource.
- args GlobalTableArgs
- The arguments to resource properties.
- opts ResourceOptions
- Bag of options to control 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.
- name String
- The unique name of the resource.
- args GlobalTableArgs
- The arguments to resource properties.
- options 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 Architecture and Concepts docs.
Inputs
The GlobalTable resource accepts the following input properties:
- Replicas
List<Pulumi.
Aws. Dynamo DB. Inputs. Global Table Replica> 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
[]Global
Table Replica Args 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<Global
Table Replica> 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
Global
Table Replica[] 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
Sequence[Global
Table Replica Args] 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.
- replicas List<Property Map>
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.
Outputs
All input properties are implicitly available as output properties. Additionally, the GlobalTable resource produces the following output properties:
Look up 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
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
arn: Optional[str] = None,
name: Optional[str] = None,
replicas: Optional[Sequence[GlobalTableReplicaArgs]] = None) -> GlobalTable
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)
public static GlobalTable get(String name, Output<String> id, GlobalTableState state, CustomResourceOptions options)
Resource lookup is not supported in YAML
- 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.
- 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.
- 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<Pulumi.
Aws. Dynamo DB. Inputs. Global Table Replica> 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
[]Global
Table Replica Args 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
List<Global
Table Replica> 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
Global
Table Replica[] 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
Sequence[Global
Table Replica Args] 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 List<Property Map>
Underlying DynamoDB Table. At least 1 replica must be defined. See below.
Supporting Types
GlobalTableReplica, GlobalTableReplicaArgs
- Region
Name string AWS region name of replica DynamoDB TableE.g.,
us-east-1
- Region
Name string AWS region name of replica DynamoDB TableE.g.,
us-east-1
- region
Name String AWS region name of replica DynamoDB TableE.g.,
us-east-1
- region
Name string AWS region name of replica DynamoDB TableE.g.,
us-east-1
- region_
name str AWS region name of replica DynamoDB TableE.g.,
us-east-1
- region
Name String AWS region name of replica DynamoDB TableE.g.,
us-east-1
Import
Using pulumi import
, import DynamoDB Global Tables using the global table name. For example:
$ pulumi import aws:dynamodb/globalTable:GlobalTable MyTable MyTable
Package Details
- Repository
- AWS Classic pulumi/pulumi-aws
- License
- Apache-2.0
- Notes
This Pulumi package is based on the
aws
Terraform Provider.
Try AWS Native preview for resources not in the classic version.