Class TableProps
Properties for a DynamoDB Table.
Inheritance
Namespace: Amazon.CDK.AWS.DynamoDB
Assembly: Amazon.CDK.AWS.DynamoDB.dll
Syntax (csharp)
public class TableProps : Object, ITableProps, ITableOptions, ISchemaOptions
Syntax (vb)
Public Class TableProps
Inherits Object
Implements ITableProps, ITableOptions, ISchemaOptions
Remarks
ExampleMetadata: infused
Examples
var globalTable = new Table(this, "Table", new TableProps {
PartitionKey = new Attribute { Name = "id", Type = AttributeType.STRING },
ReplicationRegions = new [] { "us-east-1", "us-east-2", "us-west-2" },
BillingMode = BillingMode.PROVISIONED
});
globalTable.AutoScaleWriteCapacity(new EnableScalingProps {
MinCapacity = 1,
MaxCapacity = 10
}).ScaleOnUtilization(new UtilizationScalingProps { TargetUtilizationPercent = 75 });
Synopsis
Constructors
TableProps() |
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. |
KinesisStream | Kinesis Data Stream to capture item-level changes for the table. |
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. |
TableName | |
TimeToLiveAttribute | The name of TTL attribute. |
WaitForReplicationToFinish | Indicates whether CloudFormation stack waits for replication to finish. |
WriteCapacity | The write capacity for the table. |
Constructors
TableProps()
public TableProps()
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
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.
KinesisStream
Kinesis Data Stream to capture item-level changes for the table.
public IStream KinesisStream { get; set; }
Property Value
Remarks
Default: - no Kinesis Data Stream
PartitionKey
Partition key attribute definition.
public IAttribute PartitionKey { get; set; }
Property Value
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
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
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
TableName
public string TableName { get; set; }
Property Value
System.String
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
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