Show / Hide Table of Contents

Class TableOptions

Properties of a DynamoDB Table.

Inheritance
System.Object
TableOptions
Implements
ITableOptions
ISchemaOptions
Namespace: Amazon.CDK.AWS.DynamoDB
Assembly: Amazon.CDK.AWS.DynamoDB.dll
Syntax (csharp)
public class TableOptions : Object, ITableOptions, ISchemaOptions
Syntax (vb)
Public Class TableOptions
    Inherits Object
    Implements ITableOptions, ISchemaOptions
Remarks

Use {@link TableProps} for all table properties

ExampleMetadata: fixture=_generated

Examples
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.DynamoDB;
using Amazon.CDK.AWS.KMS;
using Amazon.CDK;

Key key;
var tableOptions = new TableOptions {
    PartitionKey = new Attribute {
        Name = "name",
        Type = AttributeType.BINARY
    },

    // the properties below are optional
    BillingMode = BillingMode.PAY_PER_REQUEST,
    ContributorInsightsEnabled = false,
    Encryption = TableEncryption.DEFAULT,
    EncryptionKey = key,
    PointInTimeRecovery = false,
    ReadCapacity = 123,
    RemovalPolicy = RemovalPolicy.DESTROY,
    ReplicationRegions = new [] { "replicationRegions" },
    ReplicationTimeout = Duration.Minutes(30),
    ServerSideEncryption = false,
    SortKey = new Attribute {
        Name = "name",
        Type = AttributeType.BINARY
    },
    Stream = StreamViewType.NEW_IMAGE,
    TableClass = TableClass.STANDARD,
    TimeToLiveAttribute = "timeToLiveAttribute",
    WaitForReplicationToFinish = false,
    WriteCapacity = 123
};

Synopsis

Constructors

TableOptions()

Properties

BillingMode

Specify how you are charged for read and write throughput and how you manage capacity.

ContributorInsightsEnabled

Whether CloudWatch contributor insights is enabled.

Encryption

Whether server-side encryption with an AWS managed customer master key is enabled.

EncryptionKey

External KMS key to use for table encryption.

PartitionKey

Partition key attribute definition.

PointInTimeRecovery

Whether point-in-time recovery is enabled.

ReadCapacity

The read capacity for the table.

RemovalPolicy

The removal policy to apply to the DynamoDB Table.

ReplicationRegions

Regions where replica tables will be created.

ReplicationTimeout

The timeout for a table replication operation in a single region.

ServerSideEncryption

(deprecated) Whether server-side encryption with an AWS managed customer master key is enabled.

SortKey

Sort key attribute definition.

Stream

When an item in the table is modified, StreamViewType determines what information is written to the stream for this table.

TableClass

Specify the table class.

TimeToLiveAttribute

The name of TTL attribute.

WaitForReplicationToFinish

Indicates whether CloudFormation stack waits for replication to finish.

WriteCapacity

The write capacity for the table.

Constructors

TableOptions()

public TableOptions()

Properties

BillingMode

Specify how you are charged for read and write throughput and how you manage capacity.

public Nullable<BillingMode> BillingMode { get; set; }
Property Value

System.Nullable<BillingMode>

Remarks

Default: PROVISIONED if replicationRegions is not specified, PAY_PER_REQUEST otherwise

ContributorInsightsEnabled

Whether CloudWatch contributor insights is enabled.

public Nullable<bool> ContributorInsightsEnabled { get; set; }
Property Value

System.Nullable<System.Boolean>

Remarks

Default: false

Encryption

Whether server-side encryption with an AWS managed customer master key is enabled.

public Nullable<TableEncryption> Encryption { get; set; }
Property Value

System.Nullable<TableEncryption>

Remarks

This property cannot be set if serverSideEncryption is set.

NOTE: if you set this to CUSTOMER_MANAGED and encryptionKey is not specified, the key that the Tablet generates for you will be created with default permissions. If you are using CDKv2, these permissions will be sufficient to enable the key for use with DynamoDB tables. If you are using CDKv1, make sure the feature flag @aws-cdk/aws-kms:defaultKeyPolicies is set to true in your cdk.json.

Default: - server-side encryption is enabled with an AWS owned customer master key

EncryptionKey

External KMS key to use for table encryption.

public IKey EncryptionKey { get; set; }
Property Value

IKey

Remarks

This property can only be set if encryption is set to TableEncryption.CUSTOMER_MANAGED.

Default: - If encryption is set to TableEncryption.CUSTOMER_MANAGED and this property is undefined, a new KMS key will be created and associated with this table.

PartitionKey

Partition key attribute definition.

public IAttribute PartitionKey { get; set; }
Property Value

IAttribute

PointInTimeRecovery

Whether point-in-time recovery is enabled.

public Nullable<bool> PointInTimeRecovery { get; set; }
Property Value

System.Nullable<System.Boolean>

Remarks

Default: - point-in-time recovery is disabled

ReadCapacity

The read capacity for the table.

public Nullable<double> ReadCapacity { get; set; }
Property Value

System.Nullable<System.Double>

Remarks

Careful if you add Global Secondary Indexes, as those will share the table's provisioned throughput.

Can only be provided if billingMode is Provisioned.

Default: 5

RemovalPolicy

The removal policy to apply to the DynamoDB Table.

public Nullable<RemovalPolicy> RemovalPolicy { get; set; }
Property Value

System.Nullable<RemovalPolicy>

Remarks

Default: RemovalPolicy.RETAIN

ReplicationRegions

Regions where replica tables will be created.

public string[] ReplicationRegions { get; set; }
Property Value

System.String[]

Remarks

Default: - no replica tables are created

ReplicationTimeout

The timeout for a table replication operation in a single region.

public Duration ReplicationTimeout { get; set; }
Property Value

Duration

Remarks

Default: Duration.minutes(30)

ServerSideEncryption

(deprecated) Whether server-side encryption with an AWS managed customer master key is enabled.

public Nullable<bool> ServerSideEncryption { get; set; }
Property Value

System.Nullable<System.Boolean>

Remarks

This property cannot be set if encryption and/or encryptionKey is set.

Default: - server-side encryption is enabled with an AWS owned customer master key

Stability: Deprecated

SortKey

Sort key attribute definition.

public IAttribute SortKey { get; set; }
Property Value

IAttribute

Remarks

Default: no sort key

Stream

When an item in the table is modified, StreamViewType determines what information is written to the stream for this table.

public Nullable<StreamViewType> Stream { get; set; }
Property Value

System.Nullable<StreamViewType>

Remarks

Default: - streams are disabled unless replicationRegions is specified

TableClass

Specify the table class.

public Nullable<TableClass> TableClass { get; set; }
Property Value

System.Nullable<TableClass>

Remarks

Default: STANDARD

TimeToLiveAttribute

The name of TTL attribute.

public string TimeToLiveAttribute { get; set; }
Property Value

System.String

Remarks

Default: - TTL is disabled

WaitForReplicationToFinish

Indicates whether CloudFormation stack waits for replication to finish.

public Nullable<bool> WaitForReplicationToFinish { get; set; }
Property Value

System.Nullable<System.Boolean>

Remarks

If set to false, the CloudFormation resource will mark the resource as created and replication will be completed asynchronously. This property is ignored if replicationRegions property is not set.

DO NOT UNSET this property if adding/removing multiple replicationRegions in one deployment, as CloudFormation only supports one region replication at a time. CDK overcomes this limitation by waiting for replication to finish before starting new replicationRegion.

Default: true

See: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-dynamodb-globaltable.html#cfn-dynamodb-globaltable-replicas

WriteCapacity

The write capacity for the table.

public Nullable<double> WriteCapacity { get; set; }
Property Value

System.Nullable<System.Double>

Remarks

Careful if you add Global Secondary Indexes, as those will share the table's provisioned throughput.

Can only be provided if billingMode is Provisioned.

Default: 5

Implements

ITableOptions
ISchemaOptions
Back to top Generated by DocFX