Class TableOptions
Properties of a DynamoDB Table.
Inheritance
Namespace: Amazon.CDK.AWS.DynamoDB
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public class TableOptions : Object, ITableOptions, ISchemaOptions
Syntax (vb)
Public Class TableOptions
Inherits Object
Implements ITableOptions, ISchemaOptions
Remarks
Use 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;
using Amazon.CDK.AWS.DynamoDB;
using Amazon.CDK.AWS.KMS;
using Amazon.CDK.AWS.S3;
Bucket bucket;
InputFormat inputFormat;
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,
DeletionProtection = false,
Encryption = TableEncryption.DEFAULT,
EncryptionKey = key,
ImportSource = new ImportSourceSpecification {
Bucket = bucket,
InputFormat = inputFormat,
// the properties below are optional
BucketOwner = "bucketOwner",
CompressionType = InputCompressionType.GZIP,
KeyPrefix = "keyPrefix"
},
PointInTimeRecovery = false,
ReadCapacity = 123,
RemovalPolicy = RemovalPolicy.DESTROY,
ReplicationRegions = new [] { "replicationRegions" },
ReplicationTimeout = Duration.Minutes(30),
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. |
DeletionProtection | Enables deletion protection for the table. |
Encryption | Whether server-side encryption with an AWS managed customer master key is enabled. |
EncryptionKey | External KMS key to use for table encryption. |
ImportSource | The properties of data being imported from the S3 bucket source to 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. |
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
DeletionProtection
Enables deletion protection for the table.
public Nullable<bool> DeletionProtection { 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: - The table is encrypted with an encryption key managed by DynamoDB, and you are not charged any fee for using it.
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.
If encryption
and this property are both undefined, then the table is encrypted with
an encryption key managed by DynamoDB, and you are not charged any fee for using it.
ImportSource
The properties of data being imported from the S3 bucket source to the table.
public IImportSourceSpecification ImportSource { get; set; }
Property Value
Remarks
Default: - no data import from the S3 bucket
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)
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
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.
WARNING: 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.
If the custom resource which handles replication has a physical resource
ID with the format region
instead of tablename-region
(this would happen
if the custom resource hasn't received an event since v1.91.0), DO NOT SET
this property to false without making a change to the table name.
This will cause the existing replicas to be deleted.
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