Namespace Pulumi.Aws.DynamoDB
Classes
GetTable
GetTableArgs
GetTableResult
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.Tableresourcereplicaconfiguration 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,
});
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,
});
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",
},
},
});
}
}
GlobalTableArgs
GlobalTableState
Table
Provides a DynamoDB table resource
Note: It is recommended to use
ignoreChangesforread_capacityand/orwrite_capacityif there's autoscaling policy attached to the table.
Example Usage
using Pulumi;
using Aws = Pulumi.Aws;
class MyStack : Stack
{
public MyStack()
{
var basic_dynamodb_table = new Aws.DynamoDB.Table("basic-dynamodb-table", new Aws.DynamoDB.TableArgs
{
Attributes =
{
new Aws.DynamoDB.Inputs.TableAttributeArgs
{
Name = "UserId",
Type = "S",
},
new Aws.DynamoDB.Inputs.TableAttributeArgs
{
Name = "GameTitle",
Type = "S",
},
new Aws.DynamoDB.Inputs.TableAttributeArgs
{
Name = "TopScore",
Type = "N",
},
},
BillingMode = "PROVISIONED",
GlobalSecondaryIndexes =
{
new Aws.DynamoDB.Inputs.TableGlobalSecondaryIndexArgs
{
HashKey = "GameTitle",
Name = "GameTitleIndex",
NonKeyAttributes =
{
"UserId",
},
ProjectionType = "INCLUDE",
RangeKey = "TopScore",
ReadCapacity = 10,
WriteCapacity = 10,
},
},
HashKey = "UserId",
RangeKey = "GameTitle",
ReadCapacity = 20,
Tags =
{
{ "Environment", "production" },
{ "Name", "dynamodb-table-1" },
},
Ttl = new Aws.DynamoDB.Inputs.TableTtlArgs
{
AttributeName = "TimeToExist",
Enabled = false,
},
WriteCapacity = 20,
});
}
}
Global Tables
using Pulumi;
using Aws = Pulumi.Aws;
class MyStack : Stack
{
public MyStack()
{
var example = new Aws.DynamoDB.Table("example", new Aws.DynamoDB.TableArgs
{
Attributes =
{
new Aws.DynamoDB.Inputs.TableAttributeArgs
{
Name = "TestTableHashKey",
Type = "S",
},
},
BillingMode = "PAY_PER_REQUEST",
HashKey = "TestTableHashKey",
Replicas =
{
new Aws.DynamoDB.Inputs.TableReplicaArgs
{
RegionName = "us-east-2",
},
new Aws.DynamoDB.Inputs.TableReplicaArgs
{
RegionName = "us-west-2",
},
},
StreamEnabled = true,
StreamViewType = "NEW_AND_OLD_IMAGES",
});
}
}
TableArgs
TableItem
Provides a DynamoDB table item resource
Note: This resource is not meant to be used for managing large amounts of data in your table, it is not designed to scale. You should perform regular backups of all data in the table, see AWS docs for more.
Example Usage
using Pulumi;
using Aws = Pulumi.Aws;
class MyStack : Stack
{
public MyStack()
{
var exampleTable = new Aws.DynamoDB.Table("exampleTable", new Aws.DynamoDB.TableArgs
{
Attributes =
{
new Aws.DynamoDB.Inputs.TableAttributeArgs
{
Name = "exampleHashKey",
Type = "S",
},
},
HashKey = "exampleHashKey",
ReadCapacity = 10,
WriteCapacity = 10,
});
var exampleTableItem = new Aws.DynamoDB.TableItem("exampleTableItem", new Aws.DynamoDB.TableItemArgs
{
HashKey = exampleTable.HashKey,
Item = @"{
""exampleHashKey"": {""S"": ""something""},
""one"": {""N"": ""11111""},
""two"": {""N"": ""22222""},
""three"": {""N"": ""33333""},
""four"": {""N"": ""44444""}
}
",
TableName = exampleTable.Name,
});
}
}