Skip to content
v2.273.0

CfnTable L1 construct ​

The AWS::DynamoDB::Table resource creates a DynamoDB table. For more information, see CreateTable in the Amazon DynamoDB API Reference .

You should be aware of the following behaviors when working with DynamoDB tables:

  • AWS CloudFormation typically creates DynamoDB tables in parallel. However, if your template includes multiple DynamoDB tables with indexes, you must declare dependencies so that the tables are created sequentially. Amazon DynamoDB limits the number of tables with secondary indexes that are in the creating state. If you create multiple tables with indexes at the same time, DynamoDB returns an error and the stack operation fails. For an example, see DynamoDB Table with a DependsOn Attribute .

Our guidance is to use the latest schema documented for your AWS CloudFormation templates. This schema supports the provisioning of all table settings below. When using this schema in your AWS CloudFormation templates, please ensure that your Identity and Access Management ( IAM ) policies are updated with appropriate permissions to allow for the authorization of these setting changes.

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';

declare const policyDocument: any;
const cfnTable = new dynamodb.CfnTable(this, 'MyCfnTable', {
  keySchema: [{
    attributeName: 'attributeName',
    keyType: 'keyType',
  }],

  // the properties below are optional
  attributeDefinitions: [{
    attributeName: 'attributeName',
    attributeType: 'attributeType',
  }],
  billingMode: 'billingMode',
  contributorInsightsSpecification: {
    enabled: false,

    // the properties below are optional
    mode: 'mode',
  },
  deletionProtectionEnabled: false,
  globalSecondaryIndexes: [{
    indexName: 'indexName',
    keySchema: [{
      attributeName: 'attributeName',
      keyType: 'keyType',
    }],
    projection: {
      nonKeyAttributes: ['nonKeyAttributes'],
      projectionType: 'projectionType',
    },

    // the properties below are optional
    contributorInsightsSpecification: {
      enabled: false,

      // the properties below are optional
      mode: 'mode',
    },
    onDemandThroughput: {
      maxReadRequestUnits: 123,
      maxWriteRequestUnits: 123,
    },
    provisionedThroughput: {
      readCapacityUnits: 123,
      writeCapacityUnits: 123,
    },
    warmThroughput: {
      readUnitsPerSecond: 123,
      writeUnitsPerSecond: 123,
    },
  }],
  importSourceSpecification: {
    inputFormat: 'inputFormat',
    s3BucketSource: {
      s3Bucket: 's3Bucket',

      // the properties below are optional
      s3BucketOwner: 's3BucketOwner',
      s3KeyPrefix: 's3KeyPrefix',
    },

    // the properties below are optional
    inputCompressionType: 'inputCompressionType',
    inputFormatOptions: {
      csv: {
        delimiter: 'delimiter',
        headerList: ['headerList'],
      },
    },
  },
  kinesisStreamSpecification: {
    streamArn: 'streamArn',

    // the properties below are optional
    approximateCreationDateTimePrecision: 'approximateCreationDateTimePrecision',
  },
  localSecondaryIndexes: [{
    indexName: 'indexName',
    keySchema: [{
      attributeName: 'attributeName',
      keyType: 'keyType',
    }],
    projection: {
      nonKeyAttributes: ['nonKeyAttributes'],
      projectionType: 'projectionType',
    },
  }],
  onDemandThroughput: {
    maxReadRequestUnits: 123,
    maxWriteRequestUnits: 123,
  },
  pointInTimeRecoverySpecification: {
    pointInTimeRecoveryEnabled: false,
    recoveryPeriodInDays: 123,
  },
  provisionedThroughput: {
    readCapacityUnits: 123,
    writeCapacityUnits: 123,
  },
  resourcePolicy: {
    policyDocument: policyDocument,
  },
  sseSpecification: {
    sseEnabled: false,

    // the properties below are optional
    kmsMasterKeyId: 'kmsMasterKeyId',
    sseType: 'sseType',
  },
  streamSpecification: {
    streamViewType: 'streamViewType',

    // the properties below are optional
    resourcePolicy: {
      policyDocument: policyDocument,
    },
    tags: [{
      key: 'key',
      value: 'value',
    }],
  },
  tableClass: 'tableClass',
  tableName: 'tableName',
  tags: [{
    key: 'key',
    value: 'value',
  }],
  timeToLiveSpecification: {
    enabled: false,

    // the properties below are optional
    attributeName: 'attributeName',
  },
  vectorIndexes: [{
    dimensions: 123,
    distanceFunction: 'distanceFunction',
    indexName: 'indexName',
    projection: {
      nonKeyAttributes: ['nonKeyAttributes'],
      projectionType: 'projectionType',
    },
    vectorAttribute: {
      attributeName: 'attributeName',
    },

    // the properties below are optional
    searchSchema: [{
      attributeName: 'attributeName',
      searchSchemaElementType: 'searchSchemaElementType',
    }],
  }],
  warmThroughput: {
    readUnitsPerSecond: 123,
    writeUnitsPerSecond: 123,
  },
});
python
from aws_cdk import CfnTag, 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

# policy_document: Any

cfn_table = dynamodb.CfnTable(self, "MyCfnTable",
    key_schema=[dynamodb.CfnTable.KeySchemaProperty(
        attribute_name="attributeName",
        key_type="keyType"
    )],

    # the properties below are optional
    attribute_definitions=[dynamodb.CfnTable.AttributeDefinitionProperty(
        attribute_name="attributeName",
        attribute_type="attributeType"
    )],
    billing_mode="billingMode",
    contributor_insights_specification=dynamodb.CfnTable.ContributorInsightsSpecificationProperty(
        enabled=False,

        # the properties below are optional
        mode="mode"
    ),
    deletion_protection_enabled=False,
    global_secondary_indexes=[dynamodb.CfnTable.GlobalSecondaryIndexProperty(
        index_name="indexName",
        key_schema=[dynamodb.CfnTable.KeySchemaProperty(
            attribute_name="attributeName",
            key_type="keyType"
        )],
        projection=dynamodb.CfnTable.ProjectionProperty(
            non_key_attributes=["nonKeyAttributes"],
            projection_type="projectionType"
        ),

        # the properties below are optional
        contributor_insights_specification=dynamodb.CfnTable.ContributorInsightsSpecificationProperty(
            enabled=False,

            # the properties below are optional
            mode="mode"
        ),
        on_demand_throughput=dynamodb.CfnTable.OnDemandThroughputProperty(
            max_read_request_units=123,
            max_write_request_units=123
        ),
        provisioned_throughput=dynamodb.CfnTable.ProvisionedThroughputProperty(
            read_capacity_units=123,
            write_capacity_units=123
        ),
        warm_throughput=dynamodb.CfnTable.WarmThroughputProperty(
            read_units_per_second=123,
            write_units_per_second=123
        )
    )],
    import_source_specification=dynamodb.CfnTable.ImportSourceSpecificationProperty(
        input_format="inputFormat",
        s3_bucket_source=dynamodb.CfnTable.S3BucketSourceProperty(
            s3_bucket="s3Bucket",

            # the properties below are optional
            s3_bucket_owner="s3BucketOwner",
            s3_key_prefix="s3KeyPrefix"
        ),

        # the properties below are optional
        input_compression_type="inputCompressionType",
        input_format_options=dynamodb.CfnTable.InputFormatOptionsProperty(
            csv=dynamodb.CfnTable.CsvProperty(
                delimiter="delimiter",
                header_list=["headerList"]
            )
        )
    ),
    kinesis_stream_specification=dynamodb.CfnTable.KinesisStreamSpecificationProperty(
        stream_arn="streamArn",

        # the properties below are optional
        approximate_creation_date_time_precision="approximateCreationDateTimePrecision"
    ),
    local_secondary_indexes=[dynamodb.CfnTable.LocalSecondaryIndexProperty(
        index_name="indexName",
        key_schema=[dynamodb.CfnTable.KeySchemaProperty(
            attribute_name="attributeName",
            key_type="keyType"
        )],
        projection=dynamodb.CfnTable.ProjectionProperty(
            non_key_attributes=["nonKeyAttributes"],
            projection_type="projectionType"
        )
    )],
    on_demand_throughput=dynamodb.CfnTable.OnDemandThroughputProperty(
        max_read_request_units=123,
        max_write_request_units=123
    ),
    point_in_time_recovery_specification=dynamodb.CfnTable.PointInTimeRecoverySpecificationProperty(
        point_in_time_recovery_enabled=False,
        recovery_period_in_days=123
    ),
    provisioned_throughput=dynamodb.CfnTable.ProvisionedThroughputProperty(
        read_capacity_units=123,
        write_capacity_units=123
    ),
    resource_policy=dynamodb.CfnTable.ResourcePolicyProperty(
        policy_document=policy_document
    ),
    sse_specification=dynamodb.CfnTable.SSESpecificationProperty(
        sse_enabled=False,

        # the properties below are optional
        kms_master_key_id="kmsMasterKeyId",
        sse_type="sseType"
    ),
    stream_specification=dynamodb.CfnTable.StreamSpecificationProperty(
        stream_view_type="streamViewType",

        # the properties below are optional
        resource_policy=dynamodb.CfnTable.ResourcePolicyProperty(
            policy_document=policy_document
        ),
        tags=[CfnTag(
            key="key",
            value="value"
        )]
    ),
    table_class="tableClass",
    table_name="tableName",
    tags=[CfnTag(
        key="key",
        value="value"
    )],
    time_to_live_specification=dynamodb.CfnTable.TimeToLiveSpecificationProperty(
        enabled=False,

        # the properties below are optional
        attribute_name="attributeName"
    ),
    vector_indexes=[dynamodb.CfnTable.VectorIndexProperty(
        dimensions=123,
        distance_function="distanceFunction",
        index_name="indexName",
        projection=dynamodb.CfnTable.ProjectionProperty(
            non_key_attributes=["nonKeyAttributes"],
            projection_type="projectionType"
        ),
        vector_attribute=dynamodb.CfnTable.VectorAttributeProperty(
            attribute_name="attributeName"
        ),

        # the properties below are optional
        search_schema=[dynamodb.CfnTable.SearchSchemaElementProperty(
            attribute_name="attributeName",
            search_schema_element_type="searchSchemaElementType"
        )]
    )],
    warm_throughput=dynamodb.CfnTable.WarmThroughputProperty(
        read_units_per_second=123,
        write_units_per_second=123
    )
)
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.*;

Object policyDocument;

CfnTable cfnTable = CfnTable.Builder.create(this, "MyCfnTable")
        .keySchema(List.of(KeySchemaProperty.builder()
                .attributeName("attributeName")
                .keyType("keyType")
                .build()))

        // the properties below are optional
        .attributeDefinitions(List.of(AttributeDefinitionProperty.builder()
                .attributeName("attributeName")
                .attributeType("attributeType")
                .build()))
        .billingMode("billingMode")
        .contributorInsightsSpecification(ContributorInsightsSpecificationProperty.builder()
                .enabled(false)

                // the properties below are optional
                .mode("mode")
                .build())
        .deletionProtectionEnabled(false)
        .globalSecondaryIndexes(List.of(GlobalSecondaryIndexProperty.builder()
                .indexName("indexName")
                .keySchema(List.of(KeySchemaProperty.builder()
                        .attributeName("attributeName")
                        .keyType("keyType")
                        .build()))
                .projection(ProjectionProperty.builder()
                        .nonKeyAttributes(List.of("nonKeyAttributes"))
                        .projectionType("projectionType")
                        .build())

                // the properties below are optional
                .contributorInsightsSpecification(ContributorInsightsSpecificationProperty.builder()
                        .enabled(false)

                        // the properties below are optional
                        .mode("mode")
                        .build())
                .onDemandThroughput(OnDemandThroughputProperty.builder()
                        .maxReadRequestUnits(123)
                        .maxWriteRequestUnits(123)
                        .build())
                .provisionedThroughput(ProvisionedThroughputProperty.builder()
                        .readCapacityUnits(123)
                        .writeCapacityUnits(123)
                        .build())
                .warmThroughput(WarmThroughputProperty.builder()
                        .readUnitsPerSecond(123)
                        .writeUnitsPerSecond(123)
                        .build())
                .build()))
        .importSourceSpecification(ImportSourceSpecificationProperty.builder()
                .inputFormat("inputFormat")
                .s3BucketSource(S3BucketSourceProperty.builder()
                        .s3Bucket("s3Bucket")

                        // the properties below are optional
                        .s3BucketOwner("s3BucketOwner")
                        .s3KeyPrefix("s3KeyPrefix")
                        .build())

                // the properties below are optional
                .inputCompressionType("inputCompressionType")
                .inputFormatOptions(InputFormatOptionsProperty.builder()
                        .csv(CsvProperty.builder()
                                .delimiter("delimiter")
                                .headerList(List.of("headerList"))
                                .build())
                        .build())
                .build())
        .kinesisStreamSpecification(KinesisStreamSpecificationProperty.builder()
                .streamArn("streamArn")

                // the properties below are optional
                .approximateCreationDateTimePrecision("approximateCreationDateTimePrecision")
                .build())
        .localSecondaryIndexes(List.of(LocalSecondaryIndexProperty.builder()
                .indexName("indexName")
                .keySchema(List.of(KeySchemaProperty.builder()
                        .attributeName("attributeName")
                        .keyType("keyType")
                        .build()))
                .projection(ProjectionProperty.builder()
                        .nonKeyAttributes(List.of("nonKeyAttributes"))
                        .projectionType("projectionType")
                        .build())
                .build()))
        .onDemandThroughput(OnDemandThroughputProperty.builder()
                .maxReadRequestUnits(123)
                .maxWriteRequestUnits(123)
                .build())
        .pointInTimeRecoverySpecification(PointInTimeRecoverySpecificationProperty.builder()
                .pointInTimeRecoveryEnabled(false)
                .recoveryPeriodInDays(123)
                .build())
        .provisionedThroughput(ProvisionedThroughputProperty.builder()
                .readCapacityUnits(123)
                .writeCapacityUnits(123)
                .build())
        .resourcePolicy(ResourcePolicyProperty.builder()
                .policyDocument(policyDocument)
                .build())
        .sseSpecification(SSESpecificationProperty.builder()
                .sseEnabled(false)

                // the properties below are optional
                .kmsMasterKeyId("kmsMasterKeyId")
                .sseType("sseType")
                .build())
        .streamSpecification(StreamSpecificationProperty.builder()
                .streamViewType("streamViewType")

                // the properties below are optional
                .resourcePolicy(ResourcePolicyProperty.builder()
                        .policyDocument(policyDocument)
                        .build())
                .tags(List.of(CfnTag.builder()
                        .key("key")
                        .value("value")
                        .build()))
                .build())
        .tableClass("tableClass")
        .tableName("tableName")
        .tags(List.of(CfnTag.builder()
                .key("key")
                .value("value")
                .build()))
        .timeToLiveSpecification(TimeToLiveSpecificationProperty.builder()
                .enabled(false)

                // the properties below are optional
                .attributeName("attributeName")
                .build())
        .vectorIndexes(List.of(VectorIndexProperty.builder()
                .dimensions(123)
                .distanceFunction("distanceFunction")
                .indexName("indexName")
                .projection(ProjectionProperty.builder()
                        .nonKeyAttributes(List.of("nonKeyAttributes"))
                        .projectionType("projectionType")
                        .build())
                .vectorAttribute(VectorAttributeProperty.builder()
                        .attributeName("attributeName")
                        .build())

                // the properties below are optional
                .searchSchema(List.of(SearchSchemaElementProperty.builder()
                        .attributeName("attributeName")
                        .searchSchemaElementType("searchSchemaElementType")
                        .build()))
                .build()))
        .warmThroughput(WarmThroughputProperty.builder()
                .readUnitsPerSecond(123)
                .writeUnitsPerSecond(123)
                .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;

var policyDocument;

var cfnTable = new CfnTable(this, "MyCfnTable", new CfnTableProps {
    KeySchema = new [] { new KeySchemaProperty {
        AttributeName = "attributeName",
        KeyType = "keyType"
    } },

    // the properties below are optional
    AttributeDefinitions = new [] { new AttributeDefinitionProperty {
        AttributeName = "attributeName",
        AttributeType = "attributeType"
    } },
    BillingMode = "billingMode",
    ContributorInsightsSpecification = new ContributorInsightsSpecificationProperty {
        Enabled = false,

        // the properties below are optional
        Mode = "mode"
    },
    DeletionProtectionEnabled = false,
    GlobalSecondaryIndexes = new [] { new GlobalSecondaryIndexProperty {
        IndexName = "indexName",
        KeySchema = new [] { new KeySchemaProperty {
            AttributeName = "attributeName",
            KeyType = "keyType"
        } },
        Projection = new ProjectionProperty {
            NonKeyAttributes = new [] { "nonKeyAttributes" },
            ProjectionType = "projectionType"
        },

        // the properties below are optional
        ContributorInsightsSpecification = new ContributorInsightsSpecificationProperty {
            Enabled = false,

            // the properties below are optional
            Mode = "mode"
        },
        OnDemandThroughput = new OnDemandThroughputProperty {
            MaxReadRequestUnits = 123,
            MaxWriteRequestUnits = 123
        },
        ProvisionedThroughput = new ProvisionedThroughputProperty {
            ReadCapacityUnits = 123,
            WriteCapacityUnits = 123
        },
        WarmThroughput = new WarmThroughputProperty {
            ReadUnitsPerSecond = 123,
            WriteUnitsPerSecond = 123
        }
    } },
    ImportSourceSpecification = new ImportSourceSpecificationProperty {
        InputFormat = "inputFormat",
        S3BucketSource = new S3BucketSourceProperty {
            S3Bucket = "s3Bucket",

            // the properties below are optional
            S3BucketOwner = "s3BucketOwner",
            S3KeyPrefix = "s3KeyPrefix"
        },

        // the properties below are optional
        InputCompressionType = "inputCompressionType",
        InputFormatOptions = new InputFormatOptionsProperty {
            Csv = new CsvProperty {
                Delimiter = "delimiter",
                HeaderList = new [] { "headerList" }
            }
        }
    },
    KinesisStreamSpecification = new KinesisStreamSpecificationProperty {
        StreamArn = "streamArn",

        // the properties below are optional
        ApproximateCreationDateTimePrecision = "approximateCreationDateTimePrecision"
    },
    LocalSecondaryIndexes = new [] { new LocalSecondaryIndexProperty {
        IndexName = "indexName",
        KeySchema = new [] { new KeySchemaProperty {
            AttributeName = "attributeName",
            KeyType = "keyType"
        } },
        Projection = new ProjectionProperty {
            NonKeyAttributes = new [] { "nonKeyAttributes" },
            ProjectionType = "projectionType"
        }
    } },
    OnDemandThroughput = new OnDemandThroughputProperty {
        MaxReadRequestUnits = 123,
        MaxWriteRequestUnits = 123
    },
    PointInTimeRecoverySpecification = new PointInTimeRecoverySpecificationProperty {
        PointInTimeRecoveryEnabled = false,
        RecoveryPeriodInDays = 123
    },
    ProvisionedThroughput = new ProvisionedThroughputProperty {
        ReadCapacityUnits = 123,
        WriteCapacityUnits = 123
    },
    ResourcePolicy = new ResourcePolicyProperty {
        PolicyDocument = policyDocument
    },
    SseSpecification = new SSESpecificationProperty {
        SseEnabled = false,

        // the properties below are optional
        KmsMasterKeyId = "kmsMasterKeyId",
        SseType = "sseType"
    },
    StreamSpecification = new StreamSpecificationProperty {
        StreamViewType = "streamViewType",

        // the properties below are optional
        ResourcePolicy = new ResourcePolicyProperty {
            PolicyDocument = policyDocument
        },
        Tags = new [] { new CfnTag {
            Key = "key",
            Value = "value"
        } }
    },
    TableClass = "tableClass",
    TableName = "tableName",
    Tags = new [] { new CfnTag {
        Key = "key",
        Value = "value"
    } },
    TimeToLiveSpecification = new TimeToLiveSpecificationProperty {
        Enabled = false,

        // the properties below are optional
        AttributeName = "attributeName"
    },
    VectorIndexes = new [] { new VectorIndexProperty {
        Dimensions = 123,
        DistanceFunction = "distanceFunction",
        IndexName = "indexName",
        Projection = new ProjectionProperty {
            NonKeyAttributes = new [] { "nonKeyAttributes" },
            ProjectionType = "projectionType"
        },
        VectorAttribute = new VectorAttributeProperty {
            AttributeName = "attributeName"
        },

        // the properties below are optional
        SearchSchema = new [] { new SearchSchemaElementProperty {
            AttributeName = "attributeName",
            SearchSchemaElementType = "searchSchemaElementType"
        } }
    } },
    WarmThroughput = new WarmThroughputProperty {
        ReadUnitsPerSecond = 123,
        WriteUnitsPerSecond = 123
    }
});
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"

var policyDocument interface{}

cfnTable := awscdk.Aws_dynamodb.NewCfnTable(this, jsii.String("MyCfnTable"), &CfnTableProps{
	KeySchema: []interface{}{
		&KeySchemaProperty{
			AttributeName: jsii.String("attributeName"),
			KeyType: jsii.String("keyType"),
		},
	},

	// the properties below are optional
	AttributeDefinitions: []interface{}{
		&AttributeDefinitionProperty{
			AttributeName: jsii.String("attributeName"),
			AttributeType: jsii.String("attributeType"),
		},
	},
	BillingMode: jsii.String("billingMode"),
	ContributorInsightsSpecification: &ContributorInsightsSpecificationProperty{
		Enabled: jsii.Boolean(false),

		// the properties below are optional
		Mode: jsii.String("mode"),
	},
	DeletionProtectionEnabled: jsii.Boolean(false),
	GlobalSecondaryIndexes: []interface{}{
		&GlobalSecondaryIndexProperty{
			IndexName: jsii.String("indexName"),
			KeySchema: []interface{}{
				&KeySchemaProperty{
					AttributeName: jsii.String("attributeName"),
					KeyType: jsii.String("keyType"),
				},
			},
			Projection: &ProjectionProperty{
				NonKeyAttributes: []*string{
					jsii.String("nonKeyAttributes"),
				},
				ProjectionType: jsii.String("projectionType"),
			},

			// the properties below are optional
			ContributorInsightsSpecification: &ContributorInsightsSpecificationProperty{
				Enabled: jsii.Boolean(false),

				// the properties below are optional
				Mode: jsii.String("mode"),
			},
			OnDemandThroughput: &OnDemandThroughputProperty{
				MaxReadRequestUnits: jsii.Number(123),
				MaxWriteRequestUnits: jsii.Number(123),
			},
			ProvisionedThroughput: &ProvisionedThroughputProperty{
				ReadCapacityUnits: jsii.Number(123),
				WriteCapacityUnits: jsii.Number(123),
			},
			WarmThroughput: &WarmThroughputProperty{
				ReadUnitsPerSecond: jsii.Number(123),
				WriteUnitsPerSecond: jsii.Number(123),
			},
		},
	},
	ImportSourceSpecification: &ImportSourceSpecificationProperty{
		InputFormat: jsii.String("inputFormat"),
		S3BucketSource: &S3BucketSourceProperty{
			S3Bucket: jsii.String("s3Bucket"),

			// the properties below are optional
			S3BucketOwner: jsii.String("s3BucketOwner"),
			S3KeyPrefix: jsii.String("s3KeyPrefix"),
		},

		// the properties below are optional
		InputCompressionType: jsii.String("inputCompressionType"),
		InputFormatOptions: &InputFormatOptionsProperty{
			Csv: &CsvProperty{
				Delimiter: jsii.String("delimiter"),
				HeaderList: []*string{
					jsii.String("headerList"),
				},
			},
		},
	},
	KinesisStreamSpecification: &KinesisStreamSpecificationProperty{
		StreamArn: jsii.String("streamArn"),

		// the properties below are optional
		ApproximateCreationDateTimePrecision: jsii.String("approximateCreationDateTimePrecision"),
	},
	LocalSecondaryIndexes: []interface{}{
		&LocalSecondaryIndexProperty{
			IndexName: jsii.String("indexName"),
			KeySchema: []interface{}{
				&KeySchemaProperty{
					AttributeName: jsii.String("attributeName"),
					KeyType: jsii.String("keyType"),
				},
			},
			Projection: &ProjectionProperty{
				NonKeyAttributes: []*string{
					jsii.String("nonKeyAttributes"),
				},
				ProjectionType: jsii.String("projectionType"),
			},
		},
	},
	OnDemandThroughput: &OnDemandThroughputProperty{
		MaxReadRequestUnits: jsii.Number(123),
		MaxWriteRequestUnits: jsii.Number(123),
	},
	PointInTimeRecoverySpecification: &PointInTimeRecoverySpecificationProperty{
		PointInTimeRecoveryEnabled: jsii.Boolean(false),
		RecoveryPeriodInDays: jsii.Number(123),
	},
	ProvisionedThroughput: &ProvisionedThroughputProperty{
		ReadCapacityUnits: jsii.Number(123),
		WriteCapacityUnits: jsii.Number(123),
	},
	ResourcePolicy: &ResourcePolicyProperty{
		PolicyDocument: policyDocument,
	},
	SseSpecification: &SSESpecificationProperty{
		SseEnabled: jsii.Boolean(false),

		// the properties below are optional
		KmsMasterKeyId: jsii.String("kmsMasterKeyId"),
		SseType: jsii.String("sseType"),
	},
	StreamSpecification: &StreamSpecificationProperty{
		StreamViewType: jsii.String("streamViewType"),

		// the properties below are optional
		ResourcePolicy: &ResourcePolicyProperty{
			PolicyDocument: policyDocument,
		},
		Tags: []CfnTag{
			&CfnTag{
				Key: jsii.String("key"),
				Value: jsii.String("value"),
			},
		},
	},
	TableClass: jsii.String("tableClass"),
	TableName: jsii.String("tableName"),
	Tags: []CfnTag{
		&CfnTag{
			Key: jsii.String("key"),
			Value: jsii.String("value"),
		},
	},
	TimeToLiveSpecification: &TimeToLiveSpecificationProperty{
		Enabled: jsii.Boolean(false),

		// the properties below are optional
		AttributeName: jsii.String("attributeName"),
	},
	VectorIndexes: []interface{}{
		&VectorIndexProperty{
			Dimensions: jsii.Number(123),
			DistanceFunction: jsii.String("distanceFunction"),
			IndexName: jsii.String("indexName"),
			Projection: &ProjectionProperty{
				NonKeyAttributes: []*string{
					jsii.String("nonKeyAttributes"),
				},
				ProjectionType: jsii.String("projectionType"),
			},
			VectorAttribute: &VectorAttributeProperty{
				AttributeName: jsii.String("attributeName"),
			},

			// the properties below are optional
			SearchSchema: []interface{}{
				&SearchSchemaElementProperty{
					AttributeName: jsii.String("attributeName"),
					SearchSchemaElementType: jsii.String("searchSchemaElementType"),
				},
			},
		},
	},
	WarmThroughput: &WarmThroughputProperty{
		ReadUnitsPerSecond: jsii.Number(123),
		WriteUnitsPerSecond: jsii.Number(123),
	},
})

Initializer ​

ts
new CfnTable(scope: Construct, id: string, props: CfnTableProps)
python
CfnTable(scope: Construct, id: str, props: CfnTableProps)
java
new CfnTable(Construct scope, String id, CfnTableProps props)
csharp
new CfnTable(Construct scope, string id, CfnTableProps props)
go
NewCfnTable(Scope Construct, Id *string, Props CfnTableProps)

Construct Props ​

attributeDefinitionsIResolvable | IResolvable | CfnTable.AttributeDefinitionProperty[]attribute_definitionstyping.Union[IResolvable, typing.List[typing.Union[IResolvable, AttributeDefinitionProperty]]]attributeDefinitionsIResolvableAttributeDefinitionsIResolvableAttributeDefinitionsinterface{}#
A list of attributes that describe the key schema for the table and indexes.
notes

This property is required to create a DynamoDB table.

Update requires: Some interruptions . Replacement if you edit an existing AttributeDefinition.

billingModestringbilling_modestrbillingModeStringBillingModestringBillingMode*string#
Specify how you are charged for read and write throughput and how you manage capacity.
notes

Valid values include:

  • PAY_PER_REQUEST - We recommend using PAY_PER_REQUEST for most DynamoDB workloads. PAY_PER_REQUEST sets the billing mode to On-demand capacity mode .
  • PROVISIONED - We recommend using PROVISIONED for steady workloads with predictable growth where capacity requirements can be reliably forecasted. PROVISIONED sets the billing mode to Provisioned capacity mode .

If not specified, the default is PROVISIONED .

contributorInsightsSpecificationIResolvable | CfnTable.ContributorInsightsSpecificationPropertycontributor_insights_specificationtyping.Union[IResolvable, ContributorInsightsSpecificationProperty]contributorInsightsSpecificationIResolvableContributorInsightsSpecificationIResolvableContributorInsightsSpecificationinterface{}#
The settings used to specify whether to enable CloudWatch Contributor Insights for the table and define which events to monitor.
deletionProtectionEnabledboolean | IResolvabledeletion_protection_enabledtyping.Union[bool, IResolvable]deletionProtectionEnabledBooleanDeletionProtectionEnabledboolDeletionProtectionEnabledinterface{}#
Determines if a table is protected from deletion.
notes

When enabled, the table cannot be deleted by any user or process. This setting is disabled by default. For more information, see Using deletion protection in the Amazon DynamoDB Developer Guide .

globalSecondaryIndexesIResolvable | IResolvable | CfnTable.GlobalSecondaryIndexProperty[]global_secondary_indexestyping.Union[IResolvable, typing.List[typing.Union[IResolvable, GlobalSecondaryIndexProperty]]]globalSecondaryIndexesIResolvableGlobalSecondaryIndexesIResolvableGlobalSecondaryIndexesinterface{}#
Global secondary indexes to be created on the table. You can create up to 20 global secondary indexes.
notes

If you update a table to include a new global secondary index, AWS CloudFormation initiates the index creation and then proceeds with the stack update. AWS CloudFormation doesn't wait for the index to complete creation because the backfilling phase can take a long time, depending on the size of the table. You can't use the index or update the table until the index's status is ACTIVE . You can track its status by using the DynamoDB DescribeTable command.

If you add or delete an index during an update, we recommend that you don't update any other resources. If your stack fails to update and is rolled back while adding a new index, you must manually delete the index.

Updates are not supported. The following are exceptions:

  • If you update either the contributor insights specification or the provisioned throughput values of global secondary indexes, you can update the table without interruption.
  • You can delete or add one global secondary index without interruption. If you do both in the same update (for example, by changing the index's logical ID), the update fails.
importSourceSpecificationIResolvable | CfnTable.ImportSourceSpecificationPropertyimport_source_specificationtyping.Union[IResolvable, ImportSourceSpecificationProperty]importSourceSpecificationIResolvableImportSourceSpecificationIResolvableImportSourceSpecificationinterface{}#
Specifies the properties of data being imported from the S3 bucket source to the" table.
notes

If you specify the ImportSourceSpecification property, and also specify either the StreamSpecification , the TableClass property, the DeletionProtectionEnabled property, or the WarmThroughput property, the IAM entity creating/updating stack must have UpdateTable permission.

keySchemaIResolvable | IResolvable | CfnTable.KeySchemaProperty[]key_schematyping.Union[IResolvable, typing.List[typing.Union[IResolvable, KeySchemaProperty]]]keySchemaIResolvableKeySchemaIResolvableKeySchemainterface{}required#
Specifies the attributes that make up the primary key for the table.

The attributes in the KeySchema property must also be defined in the AttributeDefinitions property.

kinesisStreamSpecificationIResolvable | CfnTable.KinesisStreamSpecificationPropertykinesis_stream_specificationtyping.Union[IResolvable, KinesisStreamSpecificationProperty]kinesisStreamSpecificationIResolvableKinesisStreamSpecificationIResolvableKinesisStreamSpecificationinterface{}#
The Kinesis Data Streams configuration for the specified table.
localSecondaryIndexesIResolvable | IResolvable | CfnTable.LocalSecondaryIndexProperty[]local_secondary_indexestyping.Union[IResolvable, typing.List[typing.Union[IResolvable, LocalSecondaryIndexProperty]]]localSecondaryIndexesIResolvableLocalSecondaryIndexesIResolvableLocalSecondaryIndexesinterface{}#
Local secondary indexes to be created on the table.

You can create up to 5 local secondary indexes. Each index is scoped to a given hash key value. The size of each hash key can be up to 10 gigabytes.

onDemandThroughputIResolvable | CfnTable.OnDemandThroughputPropertyon_demand_throughputtyping.Union[IResolvable, OnDemandThroughputProperty]onDemandThroughputIResolvableOnDemandThroughputIResolvableOnDemandThroughputinterface{}#
Sets the maximum number of read and write units for the specified on-demand table.

If you use this property, you must specify MaxReadRequestUnits , MaxWriteRequestUnits , or both.

pointInTimeRecoverySpecificationIResolvable | CfnTable.PointInTimeRecoverySpecificationPropertypoint_in_time_recovery_specificationtyping.Union[IResolvable, PointInTimeRecoverySpecificationProperty]pointInTimeRecoverySpecificationIResolvablePointInTimeRecoverySpecificationIResolvablePointInTimeRecoverySpecificationinterface{}#
The settings used to enable point in time recovery.
provisionedThroughputIResolvable | CfnTable.ProvisionedThroughputPropertyprovisioned_throughputtyping.Union[IResolvable, ProvisionedThroughputProperty]provisionedThroughputIResolvableProvisionedThroughputIResolvableProvisionedThroughputinterface{}#
Throughput for the specified table, which consists of values for `ReadCapacityUnits` and `WriteCapacityUnits` .
notes

For more information about the contents of a provisioned throughput structure, see Amazon DynamoDB Table ProvisionedThroughput .

If you set BillingMode as PROVISIONED , you must specify this property. If you set BillingMode as PAY_PER_REQUEST , you cannot specify this property.

resourcePolicyIResolvable | CfnTable.ResourcePolicyPropertyresource_policytyping.Union[IResolvable, ResourcePolicyProperty]resourcePolicyIResolvableResourcePolicyIResolvableResourcePolicyinterface{}#
An AWS resource-based policy document in JSON format that will be attached to the table.
notes

When you attach a resource-based policy while creating a table, the policy application is strongly consistent .

The maximum size supported for a resource-based policy document is 20 KB. DynamoDB counts whitespaces when calculating the size of a policy against this limit. For a full list of all considerations that apply for resource-based policies, see Resource-based policy considerations .

You need to specify the CreateTable and PutResourcePolicy IAM actions for authorizing a user to create a table with a resource-based policy.

sseSpecificationIResolvable | CfnTable.SSESpecificationPropertysse_specificationtyping.Union[IResolvable, SSESpecificationProperty]sseSpecificationIResolvableSseSpecificationIResolvableSseSpecificationinterface{}#
Specifies the settings to enable server-side encryption.
streamSpecificationIResolvable | CfnTable.StreamSpecificationPropertystream_specificationtyping.Union[IResolvable, StreamSpecificationProperty]streamSpecificationIResolvableStreamSpecificationIResolvableStreamSpecificationinterface{}#
The settings for the DynamoDB table stream, which captures changes to items stored in the table.

Including this property in your AWS CloudFormation template automatically enables streaming.

tableClassstringtable_classstrtableClassStringTableClassstringTableClass*string#
The table class of the new table.

Valid values are STANDARD and STANDARD_INFREQUENT_ACCESS .

tableNamestringtable_namestrtableNameStringTableNamestringTableName*string#
A name for the table.
notes

If you don't specify a name, AWS CloudFormation generates a unique physical ID and uses that ID for the table name. For more information, see Name Type .

If you specify a name, you cannot perform updates that require replacement of this resource. You can perform updates that require no or some interruption. If you must replace the resource, specify a new name.

tagsCfnTag[]tagstyping.List[CfnTag]tagsList<CfnTag>TagsCfnTag[]Tags*[]CfnTag#
An array of key-value pairs to apply to this resource.

For more information, see Tag .

timeToLiveSpecificationIResolvable | CfnTable.TimeToLiveSpecificationPropertytime_to_live_specificationtyping.Union[IResolvable, TimeToLiveSpecificationProperty]timeToLiveSpecificationIResolvableTimeToLiveSpecificationIResolvableTimeToLiveSpecificationinterface{}#
Specifies the Time to Live (TTL) settings for the table.

For detailed information about the limits in DynamoDB, see Limits in Amazon DynamoDB in the Amazon DynamoDB Developer Guide.

vectorIndexesIResolvable | IResolvable | CfnTable.VectorIndexProperty[]vector_indexestyping.Union[IResolvable, typing.List[typing.Union[IResolvable, VectorIndexProperty]]]vectorIndexesIResolvableVectorIndexesIResolvableVectorIndexesinterface{}#
warmThroughputIResolvable | CfnTable.WarmThroughputPropertywarm_throughputtyping.Union[IResolvable, WarmThroughputProperty]warmThroughputIResolvableWarmThroughputIResolvableWarmThroughputinterface{}#
Represents the warm throughput (in read units per second and write units per second) for creating a table.

Properties ​

attrArnstringattr_arnstrattrArnStringAttrArnstringAttrArn*stringrequired#
The Amazon Resource Name (ARN) of the DynamoDB table, such as `arn:aws:dynamodb:us-east-2:123456789012:table/myDynamoDBTable` .
attributeDefinitionsIResolvable | IResolvable | CfnTable.AttributeDefinitionProperty[]attribute_definitionstyping.Union[IResolvable, typing.List[typing.Union[IResolvable, AttributeDefinitionProperty]]]attributeDefinitionsIResolvableAttributeDefinitionsIResolvableAttributeDefinitionsinterface{}#
A list of attributes that describe the key schema for the table and indexes.
attrStreamArnstringattr_stream_arnstrattrStreamArnStringAttrStreamArnstringAttrStreamArn*stringrequired#
The ARN of the DynamoDB stream, such as `arn:aws:dynamodb:us-east-1:123456789012:table/testddbstack-myDynamoDBTable-012A1SL7SMP5Q/stream/2015-11-30T20:10:00.000` .

You must specify the StreamSpecification property to use this attribute.

billingModestringbilling_modestrbillingModeStringBillingModestringBillingMode*string#
Specify how you are charged for read and write throughput and how you manage capacity.
CFN_RESOURCE_TYPE_NAMEstringcfn_resource_type_namestrCFN_RESOURCE_TYPE_NAMEStringCFN_RESOURCE_TYPE_NAMEstringCFN_RESOURCE_TYPE_NAME*stringrequiredstatic#
The CloudFormation resource type name for this resource class.
Options for this resource, such as condition, update policy etc.
cfnResourceTypestringcfn_resource_typestrcfnResourceTypeStringCfnResourceTypestringCfnResourceType*stringrequired#
AWS resource type.
contributorInsightsSpecificationIResolvable | CfnTable.ContributorInsightsSpecificationPropertycontributor_insights_specificationtyping.Union[IResolvable, ContributorInsightsSpecificationProperty]contributorInsightsSpecificationIResolvableContributorInsightsSpecificationIResolvableContributorInsightsSpecificationinterface{}#
The settings used to specify whether to enable CloudWatch Contributor Insights for the table and define which events to monitor.
creationStackstring[]creation_stacktyping.List[str]creationStackList<String>CreationStackstring[]CreationStack*[]*stringrequired#
deletionProtectionEnabledboolean | IResolvabledeletion_protection_enabledtyping.Union[bool, IResolvable]deletionProtectionEnabledBooleanDeletionProtectionEnabledboolDeletionProtectionEnabledinterface{}#
Determines if a table is protected from deletion.
globalSecondaryIndexesIResolvable | IResolvable | CfnTable.GlobalSecondaryIndexProperty[]global_secondary_indexestyping.Union[IResolvable, typing.List[typing.Union[IResolvable, GlobalSecondaryIndexProperty]]]globalSecondaryIndexesIResolvableGlobalSecondaryIndexesIResolvableGlobalSecondaryIndexesinterface{}#
Global secondary indexes to be created on the table.

You can create up to 20 global secondary indexes.

importSourceSpecificationIResolvable | CfnTable.ImportSourceSpecificationPropertyimport_source_specificationtyping.Union[IResolvable, ImportSourceSpecificationProperty]importSourceSpecificationIResolvableImportSourceSpecificationIResolvableImportSourceSpecificationinterface{}#
Specifies the properties of data being imported from the S3 bucket source to the" table.
keySchemaIResolvable | IResolvable | CfnTable.KeySchemaProperty[]key_schematyping.Union[IResolvable, typing.List[typing.Union[IResolvable, KeySchemaProperty]]]keySchemaIResolvableKeySchemaIResolvableKeySchemainterface{}required#
Specifies the attributes that make up the primary key for the table.
kinesisStreamSpecificationIResolvable | CfnTable.KinesisStreamSpecificationPropertykinesis_stream_specificationtyping.Union[IResolvable, KinesisStreamSpecificationProperty]kinesisStreamSpecificationIResolvableKinesisStreamSpecificationIResolvableKinesisStreamSpecificationinterface{}#
The Kinesis Data Streams configuration for the specified table.
localSecondaryIndexesIResolvable | IResolvable | CfnTable.LocalSecondaryIndexProperty[]local_secondary_indexestyping.Union[IResolvable, typing.List[typing.Union[IResolvable, LocalSecondaryIndexProperty]]]localSecondaryIndexesIResolvableLocalSecondaryIndexesIResolvableLocalSecondaryIndexesinterface{}#
Local secondary indexes to be created on the table.
logicalIdstringlogical_idstrlogicalIdStringLogicalIdstringLogicalId*stringrequired#
The logical ID for this CloudFormation stack element.

The logical ID of the element is calculated from the path of the resource node in the construct tree.

To override this value, use overrideLogicalId(newLogicalId).

nodeNodenodeNodenodeNodeNodeNodeNodeNoderequired#
The tree node.
onDemandThroughputIResolvable | CfnTable.OnDemandThroughputPropertyon_demand_throughputtyping.Union[IResolvable, OnDemandThroughputProperty]onDemandThroughputIResolvableOnDemandThroughputIResolvableOnDemandThroughputinterface{}#
Sets the maximum number of read and write units for the specified on-demand table.
pointInTimeRecoverySpecificationIResolvable | CfnTable.PointInTimeRecoverySpecificationPropertypoint_in_time_recovery_specificationtyping.Union[IResolvable, PointInTimeRecoverySpecificationProperty]pointInTimeRecoverySpecificationIResolvablePointInTimeRecoverySpecificationIResolvablePointInTimeRecoverySpecificationinterface{}#
The settings used to enable point in time recovery.
provisionedThroughputIResolvable | CfnTable.ProvisionedThroughputPropertyprovisioned_throughputtyping.Union[IResolvable, ProvisionedThroughputProperty]provisionedThroughputIResolvableProvisionedThroughputIResolvableProvisionedThroughputinterface{}#
Throughput for the specified table, which consists of values for `ReadCapacityUnits` and `WriteCapacityUnits` .
refstringrefstrrefStringRefstringRef*stringrequired#
Return a string that will be resolved to a CloudFormation `{ Ref }` for this element.

If, by any chance, the intrinsic reference of a resource is not a string, you could coerce it to an IResolvable through Lazy.any({ produce: resource.ref }).

resourcePolicyIResolvable | CfnTable.ResourcePolicyPropertyresource_policytyping.Union[IResolvable, ResourcePolicyProperty]resourcePolicyIResolvableResourcePolicyIResolvableResourcePolicyinterface{}#
An AWS resource-based policy document in JSON format that will be attached to the table.
sseSpecificationIResolvable | CfnTable.SSESpecificationPropertysse_specificationtyping.Union[IResolvable, SSESpecificationProperty]sseSpecificationIResolvableSseSpecificationIResolvableSseSpecificationinterface{}#
Specifies the settings to enable server-side encryption.
stackStackstackStackstackStackStackStackStackStackrequired#
The stack in which this element is defined.

CfnElements must be defined within a stack scope (directly or indirectly).

streamSpecificationIResolvable | CfnTable.StreamSpecificationPropertystream_specificationtyping.Union[IResolvable, StreamSpecificationProperty]streamSpecificationIResolvableStreamSpecificationIResolvableStreamSpecificationinterface{}#
The settings for the DynamoDB table stream, which captures changes to items stored in the table.
tableClassstringtable_classstrtableClassStringTableClassstringTableClass*string#
The table class of the new table.
tableNamestringtable_namestrtableNameStringTableNamestringTableName*string#
A name for the table.
tableRefTableReferencetable_refTableReferencetableRefTableReferenceTableRefTableReferenceTableRefTableReferencerequired#
A reference to a Table resource.
Tag Manager which manages the tags for this resource.
tagsRawCfnTag[]tags_rawtyping.List[CfnTag]tagsRawList<CfnTag>TagsRawCfnTag[]TagsRaw*[]CfnTag#
An array of key-value pairs to apply to this resource.
timeToLiveSpecificationIResolvable | CfnTable.TimeToLiveSpecificationPropertytime_to_live_specificationtyping.Union[IResolvable, TimeToLiveSpecificationProperty]timeToLiveSpecificationIResolvableTimeToLiveSpecificationIResolvableTimeToLiveSpecificationinterface{}#
Specifies the Time to Live (TTL) settings for the table.
vectorIndexesIResolvable | IResolvable | CfnTable.VectorIndexProperty[]vector_indexestyping.Union[IResolvable, typing.List[typing.Union[IResolvable, VectorIndexProperty]]]vectorIndexesIResolvableVectorIndexesIResolvableVectorIndexesinterface{}#
warmThroughputIResolvable | CfnTable.WarmThroughputPropertywarm_throughputtyping.Union[IResolvable, WarmThroughputProperty]warmThroughputIResolvableWarmThroughputIResolvableWarmThroughputinterface{}#
Represents the warm throughput (in read units per second and write units per second) for creating a table.

Methods ​

addDeletionOverride(path: string): voiddef add_deletion_override(self, path: str) -> Nonepublic void addDeletionOverride(String path)public void AddDeletionOverride(string path)func AddDeletionOverride(Path *string)#
Syntactic sugar for `addOverride(path, undefined)`.
1 parameter

Parameters

  • pathpathpathpathPath — The path of the value to delete.
addDependency(target: CfnResource): voiddef add_dependency(self, target: CfnResource) -> Nonepublic void addDependency(CfnResource target)public void AddDependency(CfnResource target)func AddDependency(Target CfnResource)deprecated#
Use `addResourceDependency` instead.

This method has been renamed to addResourceDependency to more clearly set it apart from construct.node.addDependency. See the documentation of that function for more details.

addDependsOn(target: CfnResource): voiddef add_depends_on(self, target: CfnResource) -> Nonepublic void addDependsOn(CfnResource target)public void AddDependsOn(CfnResource target)func AddDependsOn(Target CfnResource)deprecated#
Use `addResourceDependency` instead.
notes

This can be used for resources across stacks (or nested stack) boundaries and the dependency will automatically be transferred to the relevant scope.

This method has been renamed to addResourceDependency, which makes it more clear that this method operates at a different level from the construct-level construct.node.addDependency() mechanism.

addMetadata(key: string, value: any): voiddef add_metadata(self, key: str, value: Any) -> Nonepublic void addMetadata(String key, Object value)public void AddMetadata(string key, object value)func AddMetadata(Key *string, Value interface{})#
Add a value to the CloudFormation Resource Metadata.
addOverride(path: string, value: any): voiddef add_override(self, path: str, value: Any) -> Nonepublic void addOverride(String path, Object value)public void AddOverride(string path, object value)func AddOverride(Path *string, Value interface{})#
Adds an override to the synthesized CloudFormation resource.
notes · 2 parameters

To add a property override, either use addPropertyOverride or prefix path with "Properties." (i.e. Properties.TopicName).

If the override is nested, separate each nested level using a dot (.) in the path parameter. If there is an array as part of the nesting, specify the index in the path.

To include a literal . in the property name, prefix with a \. In most programming languages you will need to write this as "\\." because the \ itself will need to be escaped.

For example,

typescript
cfnResource.addOverride('Properties.GlobalSecondaryIndexes.0.Projection.NonKeyAttributes', ['myattribute']);
cfnResource.addOverride('Properties.GlobalSecondaryIndexes.1.ProjectionType', 'INCLUDE');

would add the overrides

json
"Properties": {
  "GlobalSecondaryIndexes": [
    {
      "Projection": {
        "NonKeyAttributes": [ "myattribute" ]
        ...
      }
      ...
    },
    {
      "ProjectionType": "INCLUDE"
      ...
    },
  ]
  ...
}

The value argument to addOverride will not be processed or translated in any way. Pass raw JSON values in here with the correct capitalization for CloudFormation. If you pass CDK classes or structs, they will be rendered with lowercased key names, and CloudFormation will reject the template.

Parameters

  • pathpathpathpathPath — - The path of the property, you can use dot notation to override values in complex types.
  • valuevaluevaluevalueValue — - The value.
addPropertyDeletionOverride(propertyPath: string): voiddef add_property_deletion_override(self, property_path: str) -> Nonepublic void addPropertyDeletionOverride(String propertyPath)public void AddPropertyDeletionOverride(string propertyPath)func AddPropertyDeletionOverride(PropertyPath *string)#
Adds an override that deletes the value of a property from the resource definition.
1 parameter

Parameters

  • propertyPathproperty_pathpropertyPathpropertyPathPropertyPath — The path to the property.
addPropertyOverride(propertyPath: string, value: any): voiddef add_property_override(self, property_path: str, value: Any) -> Nonepublic void addPropertyOverride(String propertyPath, Object value)public void AddPropertyOverride(string propertyPath, object value)func AddPropertyOverride(PropertyPath *string, Value interface{})#
Adds an override to a resource property.

Syntactic sugar for addOverride("Properties.<...>", value).

2 parameters

Parameters

  • propertyPathproperty_pathpropertyPathpropertyPathPropertyPath — The path of the property.
  • valuevaluevaluevalueValue — The value.
addResourceDependency(target: CfnResource, reason?: string): voiddef add_resource_dependency(self, target: CfnResource, reason: typing.Optional[str] = None) -> Nonepublic void addResourceDependency(CfnResource target, String reason)public void AddResourceDependency(CfnResource target, string? reason = null)func AddResourceDependency(Target CfnResource, Reason *string)#
Indicates that this resource depends on another resource and cannot be provisioned unless the other resource has been successfully provisioned.
notes

This can be used for resources across stacks (or nested stack) boundaries and the dependency will automatically be transferred to the relevant scope.

This method only adds dependencies between L1 resources. If you are looking for a generic construct-to-construct dependency mechanism that works for all constructs including L2s, use construct.node.addDependency instead.

applyCrossStackReferenceStrength(strength: ReferenceStrength): voiddef apply_cross_stack_reference_strength(self, strength: ReferenceStrength) -> Nonepublic void applyCrossStackReferenceStrength(ReferenceStrength strength)public void ApplyCrossStackReferenceStrength(ReferenceStrength strength)func ApplyCrossStackReferenceStrength(Strength ReferenceStrength)#
Sets the cross-stack reference strength for this resource.

When set, any cross-stack reference to this resource will use the specified strength instead of the global default from the consuming stack's context.

1 parameter

Parameters

  • strengthstrengthstrengthstrengthStrength — - The reference strength to use for this resource.
applyRemovalPolicy(policy?: RemovalPolicy, options?: RemovalPolicyOptions): voiddef apply_removal_policy(self, policy: typing.Optional[RemovalPolicy] = None, options: typing.Optional[RemovalPolicyOptions] = None) -> Nonepublic void applyRemovalPolicy(RemovalPolicy policy, RemovalPolicyOptions options)public void ApplyRemovalPolicy(RemovalPolicy? policy = null, RemovalPolicyOptions? options = null)func ApplyRemovalPolicy(Policy RemovalPolicy, Options RemovalPolicyOptions)#
Sets the deletion policy of the resource based on the removal policy specified.
notes

The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you've removed it from the CDK application or because you've made a change that requires the resource to be replaced.

The resource can be deleted (RemovalPolicy.DESTROY), or left in your AWS account for data recovery and cleanup later (RemovalPolicy.RETAIN). In some cases, a snapshot can be taken of the resource prior to deletion (RemovalPolicy.SNAPSHOT). A list of resources that support this policy can be found in the following link:

arnForTable(resource: ITableRef): string@staticmethod def arn_for_table(resource: ITableRef) -> strpublic static String arnForTable(ITableRef resource)public static string ArnForTable(ITableRef resource)func ArnForTable(Resource ITableRef) *stringstatic#
cfnPropertyName(cdkPropertyName: string): stringdef cfn_property_name(self, cdk_property_name: str) -> strpublic String cfnPropertyName(String cdkPropertyName)public string CfnPropertyName(string cdkPropertyName)func CfnPropertyName(CdkPropertyName *string) *string#
fromTableArn(scope: Construct, id: string, arn: string): ITableRef@staticmethod def from_table_arn(scope: Construct, id: str, arn: str) -> ITableRefpublic static ITableRef fromTableArn(Construct scope, String id, String arn)public static ITableRef FromTableArn(Construct scope, string id, string arn)func FromTableArn(Scope Construct, Id *string, Arn *string) ITableRefstatic#
Creates a new ITableRef from an ARN.
fromTableName(scope: Construct, id: string, tableName: string): ITableRef@staticmethod def from_table_name(scope: Construct, id: str, table_name: str) -> ITableRefpublic static ITableRef fromTableName(Construct scope, String id, String tableName)public static ITableRef FromTableName(Construct scope, string id, string tableName)func FromTableName(Scope Construct, Id *string, TableName *string) ITableRefstatic#
Creates a new ITableRef from a tableName.
getAtt(attributeName: string, typeHint?: ResolutionTypeHint): Referencedef get_att(self, attribute_name: str, type_hint: typing.Optional[ResolutionTypeHint] = None) -> Referencepublic Reference getAtt(String attributeName, ResolutionTypeHint typeHint)public Reference GetAtt(string attributeName, ResolutionTypeHint? typeHint = null)func GetAtt(AttributeName *string, TypeHint ResolutionTypeHint) Reference#
Returns a token for an runtime attribute of this resource.

Ideally, use generated attribute accessors (e.g. resource.arn), but this can be used for future compatibility in case there is no generated attribute.

1 parameter

Parameters

  • attributeNameattribute_nameattributeNameattributeNameAttributeName — The name of the attribute.
getMetadata(key: string): anydef get_metadata(self, key: str) -> Anypublic Object getMetadata(String key)public object GetMetadata(string key)func GetMetadata(Key *string) interface{}#
Retrieve a value value from the CloudFormation Resource Metadata.
inspect(inspector: TreeInspector): voiddef inspect(self, inspector: TreeInspector) -> Nonepublic void inspect(TreeInspector inspector)public void Inspect(TreeInspector inspector)func Inspect(Inspector TreeInspector)#
Examines the CloudFormation resource and discloses attributes.
1 parameter

Parameters

  • inspectorinspectorinspectorinspectorInspector — tree inspector to collect and process attributes.
isCfnElement(x: any): boolean@staticmethod def is_cfn_element(x: Any) -> boolpublic static Boolean isCfnElement(Object x)public static bool IsCfnElement(object x)func IsCfnElement(X interface{}) *boolstatic#
Returns `true` if a construct is a stack element (i.e. part of the synthesized cloudformation template).

Uses duck-typing instead of instanceof to allow stack elements from different versions of this library to be included in the same stack.

returns

Returns: The construct as a stack element or undefined if it is not a stack element.

isCfnResource(x: any): boolean@staticmethod def is_cfn_resource(x: Any) -> boolpublic static Boolean isCfnResource(Object x)public static bool IsCfnResource(object x)func IsCfnResource(X interface{}) *boolstatic#
Check whether the given object is a CfnResource.
isCfnTable(x: any): boolean@staticmethod def is_cfn_table(x: Any) -> boolpublic static Boolean isCfnTable(Object x)public static bool IsCfnTable(object x)func IsCfnTable(X interface{}) *boolstatic#
Checks whether the given object is a CfnTable.
isConstruct(x: any): boolean@staticmethod def is_construct(x: Any) -> boolpublic static Boolean isConstruct(Object x)public static bool IsConstruct(object x)func IsConstruct(X interface{}) *boolstatic#
Checks if `x` is a construct.
notes · 1 parameter · returns

Use this method instead of instanceof to properly detect Construct instances, even when the construct library is symlinked.

Explanation: in JavaScript, multiple copies of the constructs library on disk are seen as independent, completely different libraries. As a consequence, the class Construct in each copy of the constructs library is seen as a different class, and an instance of one class will not test as instanceof the other class. npm install will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the constructs library can be accidentally installed, and instanceof will behave unpredictably. It is safest to avoid using instanceof, and using this type-testing method instead.

Parameters

  • xxxxX — Any object.

Returns: true if x is an object created from a class which extends Construct.

obtainDependencies(): Stack | CfnResource[]def obtain_dependencies(self, ) -> typing.List[typing.Union[Stack, CfnResource]]public List<Stack> obtainDependencies()public Stack[] ObtainDependencies()func ObtainDependencies() *[]interface{}#
Retrieves an array of resources and stacks this resource depends on.

For resources depended on directly, returns the CfnResource object. For dependencies on other stacks, returns the Stack object. The order of the array is not guaranteed.

overrideLogicalId(newLogicalId: string): voiddef override_logical_id(self, new_logical_id: str) -> Nonepublic void overrideLogicalId(String newLogicalId)public void OverrideLogicalId(string newLogicalId)func OverrideLogicalId(NewLogicalId *string)#
Overrides the auto-generated logical ID with a specific ID.
1 parameter

Parameters

  • newLogicalIdnew_logical_idnewLogicalIdnewLogicalIdNewLogicalId — The new logical ID to use for this stack element.
removeDependency(target: CfnResource): voiddef remove_dependency(self, target: CfnResource) -> Nonepublic void removeDependency(CfnResource target)public void RemoveDependency(CfnResource target)func RemoveDependency(Target CfnResource)deprecated#
Use `removeResourceDependency` instead

This can be used for resources across stacks (including nested stacks) and the dependency will automatically be removed from the relevant scope.

removeResourceDependency(target: CfnResource): voiddef remove_resource_dependency(self, target: CfnResource) -> Nonepublic void removeResourceDependency(CfnResource target)public void RemoveResourceDependency(CfnResource target)func RemoveResourceDependency(Target CfnResource)#
Indicates that this resource no longer depends on another resource.

This can be used for resources across stacks (including nested stacks) and the dependency will automatically be removed from the relevant scope.

replaceDependency(target: CfnResource, newTarget: CfnResource): voiddef replace_dependency(self, target: CfnResource, new_target: CfnResource) -> Nonepublic void replaceDependency(CfnResource target, CfnResource newTarget)public void ReplaceDependency(CfnResource target, CfnResource newTarget)func ReplaceDependency(Target CfnResource, NewTarget CfnResource)#
Replaces one dependency with another.
2 parameters

Parameters

  • targettargettargettargetTarget — The dependency to replace.
  • newTargetnew_targetnewTargetnewTargetNewTarget — The new dependency to add.
toString(): stringdef to_string(self, ) -> strpublic String toString()public string ToString()func ToString() *string#
Returns a string representation of this construct.
returns

Returns: a string representation of this resource

with(...mixins: IMixin[]): IConstructdef with(self, mixins: IMixin) -> IConstructpublic IConstruct with(IMixin mixins)public IConstruct With(IMixin mixins)func With(Mixins IMixin) IConstruct#
Applies one or more mixins to this construct.

Mixins are applied in order. The list of constructs is captured at the start of the call, so constructs added by a mixin will not be visited. Use multiple with() calls if subsequent mixins should apply to added constructs.