UNPKG

@pulumi/aws

Version:

A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.

121 lines 4.55 kB
"use strict"; // *** WARNING: this file was generated by pulumi-language-nodejs. *** // *** Do not edit by hand unless you're certain you know what you are doing! *** Object.defineProperty(exports, "__esModule", { value: true }); exports.GlobalTable = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("../utilities"); /** * Manages [DynamoDB Global Tables V1 (version 2017.11.29)](https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/globaltables.V1.html). These are layered on top of existing DynamoDB Tables. * * > **NOTE:** To instead manage [DynamoDB Global Tables V2 (version 2019.11.21)](https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/globaltables.V2.html), 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](http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/globaltables_reqs_bestpractices.html) for more information. * * ## Example Usage * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * const us_east_1 = new aws.dynamodb.Table("us-east-1", { * hashKey: "myAttribute", * name: "myTable", * streamEnabled: true, * streamViewType: "NEW_AND_OLD_IMAGES", * readCapacity: 1, * writeCapacity: 1, * attributes: [{ * name: "myAttribute", * type: "S", * }], * }); * const us_west_2 = new aws.dynamodb.Table("us-west-2", { * hashKey: "myAttribute", * name: "myTable", * streamEnabled: true, * streamViewType: "NEW_AND_OLD_IMAGES", * readCapacity: 1, * writeCapacity: 1, * attributes: [{ * name: "myAttribute", * type: "S", * }], * }); * const myTable = new aws.dynamodb.GlobalTable("myTable", { * name: "myTable", * replicas: [ * { * regionName: "us-east-1", * }, * { * regionName: "us-west-2", * }, * ], * }, { * dependsOn: [ * us_east_1, * us_west_2, * ], * }); * ``` * * ## Import * * Using `pulumi import`, import DynamoDB Global Tables using the global table name. For example: * * ```sh * $ pulumi import aws:dynamodb/globalTable:GlobalTable MyTable MyTable * ``` */ class GlobalTable extends pulumi.CustomResource { /** * Get an existing GlobalTable resource's state with the given name, ID, and optional extra * properties used to qualify the lookup. * * @param name The _unique_ name of the resulting resource. * @param id The _unique_ provider ID of the resource to lookup. * @param state Any extra arguments used during the lookup. * @param opts Optional settings to control the behavior of the CustomResource. */ static get(name, id, state, opts) { return new GlobalTable(name, state, { ...opts, id: id }); } /** * Returns true if the given object is an instance of GlobalTable. This is designed to work even * when multiple copies of the Pulumi SDK have been loaded into the same process. */ static isInstance(obj) { if (obj === undefined || obj === null) { return false; } return obj['__pulumiType'] === GlobalTable.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["arn"] = state?.arn; resourceInputs["name"] = state?.name; resourceInputs["region"] = state?.region; resourceInputs["replicas"] = state?.replicas; } else { const args = argsOrState; if (args?.replicas === undefined && !opts.urn) { throw new Error("Missing required property 'replicas'"); } resourceInputs["name"] = args?.name; resourceInputs["region"] = args?.region; resourceInputs["replicas"] = args?.replicas; resourceInputs["arn"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(GlobalTable.__pulumiType, name, resourceInputs, opts); } } exports.GlobalTable = GlobalTable; /** @internal */ GlobalTable.__pulumiType = 'aws:dynamodb/globalTable:GlobalTable'; //# sourceMappingURL=globalTable.js.map