TableOptionsV2 Struct
Options used to configure a DynamoDB table.
| Source | aws-dynamodb/lib/table-v2.ts |
|---|---|
| Type last changed |
Example
ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_dynamodb as dynamodb } from 'aws-cdk-lib';
import { aws_iam as iam } from 'aws-cdk-lib';
import { aws_kinesis as kinesis } from 'aws-cdk-lib';
declare const policyDocument: iam.PolicyDocument;
declare const stream: kinesis.Stream;
const tableOptionsV2: dynamodb.TableOptionsV2 = {
contributorInsights: false,
contributorInsightsSpecification: {
enabled: false,
// the properties below are optional
mode: dynamodb.ContributorInsightsMode.ACCESSED_AND_THROTTLED_KEYS,
},
deletionProtection: false,
kinesisStream: stream,
pointInTimeRecovery: false,
pointInTimeRecoverySpecification: {
pointInTimeRecoveryEnabled: false,
// the properties below are optional
recoveryPeriodInDays: 123,
},
resourcePolicy: policyDocument,
streamResourcePolicy: policyDocument,
tableClass: dynamodb.TableClass.STANDARD,
tags: [{
key: 'key',
value: 'value',
}],
};
python
from aws_cdk import CfnTag
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_dynamodb as dynamodb
from aws_cdk import aws_iam as iam
from aws_cdk import aws_kinesis as kinesis
# policy_document: iam.PolicyDocument
# stream: kinesis.Stream
table_options_v2 = dynamodb.TableOptionsV2(
contributor_insights=False,
contributor_insights_specification=dynamodb.ContributorInsightsSpecification(
enabled=False,
# the properties below are optional
mode=dynamodb.ContributorInsightsMode.ACCESSED_AND_THROTTLED_KEYS
),
deletion_protection=False,
kinesis_stream=stream,
point_in_time_recovery=False,
point_in_time_recovery_specification=dynamodb.PointInTimeRecoverySpecification(
point_in_time_recovery_enabled=False,
# the properties below are optional
recovery_period_in_days=123
),
resource_policy=policy_document,
stream_resource_policy=policy_document,
table_class=dynamodb.TableClass.STANDARD,
tags=[CfnTag(
key="key",
value="value"
)]
)
java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.services.dynamodb.*;
import software.amazon.awscdk.services.iam.*;
import software.amazon.awscdk.services.kinesis.*;
PolicyDocument policyDocument;
Stream stream;
TableOptionsV2 tableOptionsV2 = TableOptionsV2.builder()
.contributorInsights(false)
.contributorInsightsSpecification(ContributorInsightsSpecification.builder()
.enabled(false)
// the properties below are optional
.mode(ContributorInsightsMode.ACCESSED_AND_THROTTLED_KEYS)
.build())
.deletionProtection(false)
.kinesisStream(stream)
.pointInTimeRecovery(false)
.pointInTimeRecoverySpecification(PointInTimeRecoverySpecification.builder()
.pointInTimeRecoveryEnabled(false)
// the properties below are optional
.recoveryPeriodInDays(123)
.build())
.resourcePolicy(policyDocument)
.streamResourcePolicy(policyDocument)
.tableClass(TableClass.STANDARD)
.tags(List.of(CfnTag.builder()
.key("key")
.value("value")
.build()))
.build();
csharp
// Install: dotnet add package Amazon.CDK.Lib
// 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.IAM;
using Amazon.CDK.AWS.Kinesis;
PolicyDocument policyDocument;
Stream stream;
var tableOptionsV2 = new TableOptionsV2 {
ContributorInsights = false,
ContributorInsightsSpecification = new ContributorInsightsSpecification {
Enabled = false,
// the properties below are optional
Mode = ContributorInsightsMode.ACCESSED_AND_THROTTLED_KEYS
},
DeletionProtection = false,
KinesisStream = stream,
PointInTimeRecovery = false,
PointInTimeRecoverySpecification = new PointInTimeRecoverySpecification {
PointInTimeRecoveryEnabled = false,
// the properties below are optional
RecoveryPeriodInDays = 123
},
ResourcePolicy = policyDocument,
StreamResourcePolicy = policyDocument,
TableClass = TableClass.STANDARD,
Tags = new [] { new CfnTag {
Key = "key",
Value = "value"
} }
};
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/aws-cdk-go/awscdk"
var policyDocument PolicyDocument
var stream Stream
tableOptionsV2 := &TableOptionsV2{
ContributorInsights: jsii.Boolean(false),
ContributorInsightsSpecification: &ContributorInsightsSpecification{
Enabled: jsii.Boolean(false),
// the properties below are optional
Mode: awscdk.Aws_dynamodb.ContributorInsightsMode_ACCESSED_AND_THROTTLED_KEYS,
},
DeletionProtection: jsii.Boolean(false),
KinesisStream: stream,
PointInTimeRecovery: jsii.Boolean(false),
PointInTimeRecoverySpecification: &PointInTimeRecoverySpecification{
PointInTimeRecoveryEnabled: jsii.Boolean(false),
// the properties below are optional
RecoveryPeriodInDays: jsii.Number(123),
},
ResourcePolicy: policyDocument,
StreamResourcePolicy: policyDocument,
TableClass: awscdk.*Aws_dynamodb.TableClass_STANDARD,
Tags: []CfnTag{
&CfnTag{
Key: jsii.String("key"),
Value: jsii.String("value"),
},
},
}
Properties
contributorInsightsoptionalbooleancontributor_insightsoptionalboolcontributorInsightsoptionalBooleanContributorInsightsoptionalboolContributorInsightsoptional*bool = false deprecated #use `contributorInsightsSpecification` instead
contributorInsightsSpecificationoptionalContributorInsightsSpecificationcontributor_insights_specificationoptionalContributorInsightsSpecificationcontributorInsightsSpecificationoptionalContributorInsightsSpecificationContributorInsightsSpecificationoptionalContributorInsightsSpecificationContributorInsightsSpecificationoptionalContributorInsightsSpecification #Whether CloudWatch contributor insights is enabled and what mode is selected.
Default: contributor insights is not enabled
deletionProtectionoptionalbooleandeletion_protectionoptionalbooldeletionProtectionoptionalBooleanDeletionProtectionoptionalboolDeletionProtectionoptional*bool = false #Whether deletion protection is enabled.
kinesisStreamoptionalIStreamkinesis_streamoptionalIStreamkinesisStreamoptionalIStreamKinesisStreamoptionalIStreamKinesisStreamoptionalIStream #Kinesis Data Stream to capture item level changes.
Default: no Kinesis Data Stream
pointInTimeRecoveryoptionalbooleanpoint_in_time_recoveryoptionalboolpointInTimeRecoveryoptionalBooleanPointInTimeRecoveryoptionalboolPointInTimeRecoveryoptional*bool deprecated #use `pointInTimeRecoverySpecification` instead
Default: false - point in time recovery is not enabled.
pointInTimeRecoverySpecificationoptionalPointInTimeRecoverySpecificationpoint_in_time_recovery_specificationoptionalPointInTimeRecoverySpecificationpointInTimeRecoverySpecificationoptionalPointInTimeRecoverySpecificationPointInTimeRecoverySpecificationoptionalPointInTimeRecoverySpecificationPointInTimeRecoverySpecificationoptionalPointInTimeRecoverySpecification #Whether point-in-time recovery is enabled and recoveryPeriodInDays is set.
Default: point in time recovery is not enabled.
resourcePolicyoptionalPolicyDocumentresource_policyoptionalPolicyDocumentresourcePolicyoptionalPolicyDocumentResourcePolicyoptionalPolicyDocumentResourcePolicyoptionalPolicyDocument #Resource policy to assign to DynamoDB Table.
Default: No resource policy statements are added to the created table.
streamResourcePolicyoptionalPolicyDocumentstream_resource_policyoptionalPolicyDocumentstreamResourcePolicyoptionalPolicyDocumentStreamResourcePolicyoptionalPolicyDocumentStreamResourcePolicyoptionalPolicyDocument #Resource policy to assign to DynamoDB Stream.
Default: No resource policy statements are added to the stream.
tableClassoptionalTableClasstable_classoptionalTableClasstableClassoptionalTableClassTableClassoptionalTableClassTableClassoptionalTableClass = TableClass.STANDARD #The table class.