Class 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",
});
}
}
Inherited Members
Namespace: Pulumi.Aws.DynamoDB
Assembly: Pulumi.Aws.dll
Syntax
public class Table : CustomResource
Constructors
View SourceTable(String, TableArgs, CustomResourceOptions)
Create a Table resource with the given unique name, arguments, and options.
Declaration
public Table(string name, TableArgs args, CustomResourceOptions options = null)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | name | The unique name of the resource |
| TableArgs | args | The arguments used to populate this resource's properties |
| CustomResourceOptions | options | A bag of options that control this resource's behavior |
Properties
View SourceArn
The arn of the table
Declaration
public Output<string> Arn { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
Attributes
List of nested attribute definitions. Only required for hash_key and range_key attributes. Each attribute has two properties:
Declaration
public Output<ImmutableArray<TableAttribute>> Attributes { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.Collections.Immutable.ImmutableArray<TableAttribute>> |
BillingMode
Controls how you are charged for read and write throughput and how you manage capacity. The valid values are PROVISIONED and PAY_PER_REQUEST. Defaults to PROVISIONED.
Declaration
public Output<string> BillingMode { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
GlobalSecondaryIndexes
Describe a GSI for the table; subject to the normal limits on the number of GSIs, projected attributes, etc.
Declaration
public Output<ImmutableArray<TableGlobalSecondaryIndex>> GlobalSecondaryIndexes { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.Collections.Immutable.ImmutableArray<TableGlobalSecondaryIndex>> |
HashKey
The name of the hash key in the index; must be defined as an attribute in the resource.
Declaration
public Output<string> HashKey { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
LocalSecondaryIndexes
Describe an LSI on the table; these can only be allocated at creation so you cannot change this definition after you have created the resource.
Declaration
public Output<ImmutableArray<TableLocalSecondaryIndex>> LocalSecondaryIndexes { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.Collections.Immutable.ImmutableArray<TableLocalSecondaryIndex>> |
Name
The name of the index
Declaration
public Output<string> Name { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
PointInTimeRecovery
Point-in-time recovery options.
Declaration
public Output<TablePointInTimeRecovery> PointInTimeRecovery { get; }
Property Value
| Type | Description |
|---|---|
| Output<TablePointInTimeRecovery> |
RangeKey
The name of the range key; must be defined
Declaration
public Output<string> RangeKey { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
ReadCapacity
The number of read units for this index. Must be set if billing_mode is set to PROVISIONED.
Declaration
public Output<int?> ReadCapacity { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.Nullable<System.Int32>> |
Replicas
Configuration block(s) with DynamoDB Global Tables V2 (version 2019.11.21) replication configurations. Detailed below.
Declaration
public Output<ImmutableArray<TableReplica>> Replicas { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.Collections.Immutable.ImmutableArray<TableReplica>> |
ServerSideEncryption
Encryption at rest options. AWS DynamoDB tables are automatically encrypted at rest with an AWS owned Customer Master Key if this argument isn't specified.
Declaration
public Output<TableServerSideEncryption> ServerSideEncryption { get; }
Property Value
| Type | Description |
|---|---|
| Output<TableServerSideEncryption> |
StreamArn
The ARN of the Table Stream. Only available when stream_enabled = true
Declaration
public Output<string> StreamArn { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
StreamEnabled
Indicates whether Streams are to be enabled (true) or disabled (false).
Declaration
public Output<bool?> StreamEnabled { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.Nullable<System.Boolean>> |
StreamLabel
A timestamp, in ISO 8601 format, for this stream. Note that this timestamp is not
a unique identifier for the stream on its own. However, the combination of AWS customer ID,
table name and this field is guaranteed to be unique.
It can be used for creating CloudWatch Alarms. Only available when stream_enabled = true
Declaration
public Output<string> StreamLabel { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
StreamViewType
When an item in the table is modified, StreamViewType determines what information is written to the table's stream. Valid values are KEYS_ONLY, NEW_IMAGE, OLD_IMAGE, NEW_AND_OLD_IMAGES.
Declaration
public Output<string> StreamViewType { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.String> |
Tags
A map of tags to populate on the created table.
Declaration
public Output<ImmutableDictionary<string, object>> Tags { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.Collections.Immutable.ImmutableDictionary<System.String, System.Object>> |
Ttl
Defines ttl, has two properties, and can only be specified once:
Declaration
public Output<TableTtl> Ttl { get; }
Property Value
| Type | Description |
|---|---|
| Output<TableTtl> |
WriteCapacity
The number of write units for this index. Must be set if billing_mode is set to PROVISIONED.
Declaration
public Output<int?> WriteCapacity { get; }
Property Value
| Type | Description |
|---|---|
| Output<System.Nullable<System.Int32>> |
Methods
View SourceGet(String, Input<String>, TableState, CustomResourceOptions)
Get an existing Table resource's state with the given name, ID, and optional extra properties used to qualify the lookup.
Declaration
public static Table Get(string name, Input<string> id, TableState state = null, CustomResourceOptions options = null)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | name | The unique name of the resulting resource. |
| Input<System.String> | id | The unique provider ID of the resource to lookup. |
| TableState | state | Any extra arguments used during the lookup. |
| CustomResourceOptions | options | A bag of options that control this resource's behavior |
Returns
| Type | Description |
|---|---|
| Table |