# TableOptionsV2

Options used to configure a DynamoDB table.

- Source: [`aws-dynamodb/lib/table-v2.ts`](https://github.com/aws/aws-cdk/blob/v2.278.0/packages/aws-cdk-lib/aws-dynamodb/lib/table-v2.ts#L229)
- Type last changed: v2.254.0 · 13 May 2026

## Example

TypeScript:

```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:

```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:

```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();
```

C# / .NET:

```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"
    } }
};
```

Golang:

```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

- `contributorInsights`: boolean = false — use `contributorInsightsSpecification` instead

- `contributorInsightsSpecification`: [ContributorInsightsSpecification](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_dynamodb.ContributorInsightsSpecification.html) — Whether CloudWatch contributor insights is enabled and what mode is selected.

  **Default:** contributor insights is not enabled

- `deletionProtection`: boolean = false — Whether deletion protection is enabled.

- `kinesisStream`: [IStream](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_kinesis.IStream.html) — Kinesis Data Stream to capture item level changes.

  **Default:** no Kinesis Data Stream

- `pointInTimeRecovery`: boolean — use `pointInTimeRecoverySpecification` instead

  **Default:** false - point in time recovery is not enabled.

- `pointInTimeRecoverySpecification`: [PointInTimeRecoverySpecification](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_dynamodb.PointInTimeRecoverySpecification.html) — Whether point-in-time recovery is enabled and recoveryPeriodInDays is set.

  **Default:** point in time recovery is not enabled.

- `resourcePolicy`: [PolicyDocument](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_iam.PolicyDocument.html) — Resource policy to assign to DynamoDB Table.

  **Default:** No resource policy statements are added to the created table.

- `streamResourcePolicy`: [PolicyDocument](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_iam.PolicyDocument.html) — Resource policy to assign to DynamoDB Stream.

  **Default:** No resource policy statements are added to the stream.

- `tableClass`: [TableClass](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_dynamodb.TableClass.html) = TableClass.STANDARD — The table class.

- `tags`: [CfnTag](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.CfnTag.html)[] — Tags to be applied to the primary table (default replica table).

  **Default:** no tags
