Global Table
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
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());
}
}
Content copied to clipboard
Import
DynamoDB Global Tables can be imported using the global table name, e.g.,
$ pulumi import aws:dynamodb/globalTable:GlobalTable MyTable MyTable
Content copied to clipboard