aws-cdk-lib.aws_dynamodb.CfnTable

class CfnTable (construct)

LanguageType name
.NETAmazon.CDK.AWS.DynamoDB.CfnTable
Gogithub.com/aws/aws-cdk-go/awscdk/v2/awsdynamodb#CfnTable
Javasoftware.amazon.awscdk.services.dynamodb.CfnTable
Pythonaws_cdk.aws_dynamodb.CfnTable
TypeScript aws-cdk-lib » aws_dynamodb » CfnTable

Implements IConstruct, IDependable, IInspectable

A CloudFormation AWS::DynamoDB::Table.

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

// 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';
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,
  },
  deletionProtectionEnabled: false,
  globalSecondaryIndexes: [{
    indexName: 'indexName',
    keySchema: [{
      attributeName: 'attributeName',
      keyType: 'keyType',
    }],
    projection: {
      nonKeyAttributes: ['nonKeyAttributes'],
      projectionType: 'projectionType',
    },

    // the properties below are optional
    contributorInsightsSpecification: {
      enabled: false,
    },
    provisionedThroughput: {
      readCapacityUnits: 123,
      writeCapacityUnits: 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',
  },
  localSecondaryIndexes: [{
    indexName: 'indexName',
    keySchema: [{
      attributeName: 'attributeName',
      keyType: 'keyType',
    }],
    projection: {
      nonKeyAttributes: ['nonKeyAttributes'],
      projectionType: 'projectionType',
    },
  }],
  pointInTimeRecoverySpecification: {
    pointInTimeRecoveryEnabled: false,
  },
  provisionedThroughput: {
    readCapacityUnits: 123,
    writeCapacityUnits: 123,
  },
  sseSpecification: {
    sseEnabled: false,

    // the properties below are optional
    kmsMasterKeyId: 'kmsMasterKeyId',
    sseType: 'sseType',
  },
  streamSpecification: {
    streamViewType: 'streamViewType',
  },
  tableClass: 'tableClass',
  tableName: 'tableName',
  tags: [{
    key: 'key',
    value: 'value',
  }],
  timeToLiveSpecification: {
    enabled: false,

    // the properties below are optional
    attributeName: 'attributeName',
  },
});

Initializer

new CfnTable(scope: Construct, id: string, props: CfnTableProps)

Parameters

  • scope Construct — - scope in which this resource is defined.
  • id string — - scoped id of the resource.
  • props CfnTableProps — - resource properties.

Create a new AWS::DynamoDB::Table.

Construct Props

NameTypeDescription
keySchemaIResolvable | IResolvable | KeySchemaProperty[]Specifies the attributes that make up the primary key for the table.
attributeDefinitions?IResolvable | IResolvable | AttributeDefinitionProperty[]A list of attributes that describe the key schema for the table and indexes.
billingMode?stringSpecify how you are charged for read and write throughput and how you manage capacity.
contributorInsightsSpecification?IResolvable | ContributorInsightsSpecificationPropertyThe settings used to enable or disable CloudWatch Contributor Insights for the specified table.
deletionProtectionEnabled?boolean | IResolvableDetermines if a table is protected from deletion.
globalSecondaryIndexes?IResolvable | IResolvable | GlobalSecondaryIndexProperty[]Global secondary indexes to be created on the table. You can create up to 20 global secondary indexes.
importSourceSpecification?IResolvable | ImportSourceSpecificationPropertySpecifies the properties of data being imported from the S3 bucket source to the table.
kinesisStreamSpecification?IResolvable | KinesisStreamSpecificationPropertyThe Kinesis Data Streams configuration for the specified table.
localSecondaryIndexes?IResolvable | IResolvable | LocalSecondaryIndexProperty[]Local secondary indexes to be created on the table.
pointInTimeRecoverySpecification?IResolvable | PointInTimeRecoverySpecificationPropertyThe settings used to enable point in time recovery.
provisionedThroughput?IResolvable | ProvisionedThroughputPropertyThroughput for the specified table, which consists of values for ReadCapacityUnits and WriteCapacityUnits .
sseSpecification?IResolvable | SSESpecificationPropertySpecifies the settings to enable server-side encryption.
streamSpecification?IResolvable | StreamSpecificationPropertyThe settings for the DynamoDB table stream, which capture changes to items stored in the table.
tableClass?stringThe table class of the new table.
tableName?stringA name for the table.
tags?CfnTag[]An array of key-value pairs to apply to this resource.
timeToLiveSpecification?IResolvable | TimeToLiveSpecificationPropertySpecifies the Time to Live (TTL) settings for the table.

keySchema

Type: IResolvable | IResolvable | KeySchemaProperty[]

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.


attributeDefinitions?

Type: IResolvable | IResolvable | AttributeDefinitionProperty[] (optional)

A list of attributes that describe the key schema for the table and indexes.

This property is required to create a DynamoDB table.

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


billingMode?

Type: string (optional)

Specify how you are charged for read and write throughput and how you manage capacity.

Valid values include:

  • PROVISIONED - We recommend using PROVISIONED for predictable workloads. PROVISIONED sets the billing mode to Provisioned Mode .
  • PAY_PER_REQUEST - We recommend using PAY_PER_REQUEST for unpredictable workloads. PAY_PER_REQUEST sets the billing mode to On-Demand Mode .

If not specified, the default is PROVISIONED .


contributorInsightsSpecification?

Type: IResolvable | ContributorInsightsSpecificationProperty (optional)

The settings used to enable or disable CloudWatch Contributor Insights for the specified table.


deletionProtectionEnabled?

Type: boolean | IResolvable (optional)

Determines if a table is protected from deletion.

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 .


globalSecondaryIndexes?

Type: IResolvable | IResolvable | GlobalSecondaryIndexProperty[] (optional)

Global secondary indexes to be created on the table. You can create up to 20 global secondary indexes.

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.

importSourceSpecification?

Type: IResolvable | ImportSourceSpecificationProperty (optional)

Specifies the properties of data being imported from the S3 bucket source to the table.

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


kinesisStreamSpecification?

Type: IResolvable | KinesisStreamSpecificationProperty (optional)

The Kinesis Data Streams configuration for the specified table.


localSecondaryIndexes?

Type: IResolvable | IResolvable | LocalSecondaryIndexProperty[] (optional)

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.


pointInTimeRecoverySpecification?

Type: IResolvable | PointInTimeRecoverySpecificationProperty (optional)

The settings used to enable point in time recovery.


provisionedThroughput?

Type: IResolvable | ProvisionedThroughputProperty (optional)

Throughput for the specified table, which consists of values for ReadCapacityUnits and WriteCapacityUnits .

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.


sseSpecification?

Type: IResolvable | SSESpecificationProperty (optional)

Specifies the settings to enable server-side encryption.


streamSpecification?

Type: IResolvable | StreamSpecificationProperty (optional)

The settings for the DynamoDB table stream, which capture changes to items stored in the table.


tableClass?

Type: string (optional)

The table class of the new table.

Valid values are STANDARD and STANDARD_INFREQUENT_ACCESS .


tableName?

Type: string (optional)

A name for the table.

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.


tags?

Type: CfnTag[] (optional)

An array of key-value pairs to apply to this resource.

For more information, see Tag .


timeToLiveSpecification?

Type: IResolvable | TimeToLiveSpecificationProperty (optional)

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.

Properties

NameTypeDescription
attrArnstringThe Amazon Resource Name (ARN) of the DynamoDB table, such as arn:aws:dynamodb:us-east-2:123456789012:table/myDynamoDBTable .
attrStreamArnstringThe 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 .
cfnOptionsICfnResourceOptionsOptions for this resource, such as condition, update policy etc.
cfnProperties{ [string]: any }
cfnResourceTypestringAWS resource type.
creationStackstring[]
keySchemaIResolvable | IResolvable | KeySchemaProperty[]Specifies the attributes that make up the primary key for the table.
logicalIdstringThe logical ID for this CloudFormation stack element.
nodeNodeThe tree node.
refstringReturn a string that will be resolved to a CloudFormation { Ref } for this element.
stackStackThe stack in which this element is defined.
tagsTagManagerAn array of key-value pairs to apply to this resource.
attributeDefinitions?IResolvable | IResolvable | AttributeDefinitionProperty[]A list of attributes that describe the key schema for the table and indexes.
billingMode?stringSpecify how you are charged for read and write throughput and how you manage capacity.
contributorInsightsSpecification?IResolvable | ContributorInsightsSpecificationPropertyThe settings used to enable or disable CloudWatch Contributor Insights for the specified table.
deletionProtectionEnabled?boolean | IResolvableDetermines if a table is protected from deletion.
globalSecondaryIndexes?IResolvable | IResolvable | GlobalSecondaryIndexProperty[]Global secondary indexes to be created on the table. You can create up to 20 global secondary indexes.
importSourceSpecification?IResolvable | ImportSourceSpecificationPropertySpecifies the properties of data being imported from the S3 bucket source to the table.
kinesisStreamSpecification?IResolvable | KinesisStreamSpecificationPropertyThe Kinesis Data Streams configuration for the specified table.
localSecondaryIndexes?IResolvable | IResolvable | LocalSecondaryIndexProperty[]Local secondary indexes to be created on the table.
pointInTimeRecoverySpecification?IResolvable | PointInTimeRecoverySpecificationPropertyThe settings used to enable point in time recovery.
provisionedThroughput?IResolvable | ProvisionedThroughputPropertyThroughput for the specified table, which consists of values for ReadCapacityUnits and WriteCapacityUnits .
sseSpecification?IResolvable | SSESpecificationPropertySpecifies the settings to enable server-side encryption.
streamSpecification?IResolvable | StreamSpecificationPropertyThe settings for the DynamoDB table stream, which capture changes to items stored in the table.
tableClass?stringThe table class of the new table.
tableName?stringA name for the table.
timeToLiveSpecification?IResolvable | TimeToLiveSpecificationPropertySpecifies the Time to Live (TTL) settings for the table.
static CFN_RESOURCE_TYPE_NAMEstringThe CloudFormation resource type name for this resource class.

attrArn

Type: string

The Amazon Resource Name (ARN) of the DynamoDB table, such as arn:aws:dynamodb:us-east-2:123456789012:table/myDynamoDBTable .


attrStreamArn

Type: string

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.


cfnOptions

Type: ICfnResourceOptions

Options for this resource, such as condition, update policy etc.


cfnProperties

Type: { [string]: any }


cfnResourceType

Type: string

AWS resource type.


creationStack

Type: string[]


keySchema

Type: IResolvable | IResolvable | KeySchemaProperty[]

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.


logicalId

Type: string

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).


node

Type: Node

The tree node.


ref

Type: string

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 }).


stack

Type: Stack

The stack in which this element is defined.

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


tags

Type: TagManager

An array of key-value pairs to apply to this resource.

For more information, see Tag .


attributeDefinitions?

Type: IResolvable | IResolvable | AttributeDefinitionProperty[] (optional)

A list of attributes that describe the key schema for the table and indexes.

This property is required to create a DynamoDB table.

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


billingMode?

Type: string (optional)

Specify how you are charged for read and write throughput and how you manage capacity.

Valid values include:

  • PROVISIONED - We recommend using PROVISIONED for predictable workloads. PROVISIONED sets the billing mode to Provisioned Mode .
  • PAY_PER_REQUEST - We recommend using PAY_PER_REQUEST for unpredictable workloads. PAY_PER_REQUEST sets the billing mode to On-Demand Mode .

If not specified, the default is PROVISIONED .


contributorInsightsSpecification?

Type: IResolvable | ContributorInsightsSpecificationProperty (optional)

The settings used to enable or disable CloudWatch Contributor Insights for the specified table.


deletionProtectionEnabled?

Type: boolean | IResolvable (optional)

Determines if a table is protected from deletion.

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 .


globalSecondaryIndexes?

Type: IResolvable | IResolvable | GlobalSecondaryIndexProperty[] (optional)

Global secondary indexes to be created on the table. You can create up to 20 global secondary indexes.

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.

importSourceSpecification?

Type: IResolvable | ImportSourceSpecificationProperty (optional)

Specifies the properties of data being imported from the S3 bucket source to the table.

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


kinesisStreamSpecification?

Type: IResolvable | KinesisStreamSpecificationProperty (optional)

The Kinesis Data Streams configuration for the specified table.


localSecondaryIndexes?

Type: IResolvable | IResolvable | LocalSecondaryIndexProperty[] (optional)

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.


pointInTimeRecoverySpecification?

Type: IResolvable | PointInTimeRecoverySpecificationProperty (optional)

The settings used to enable point in time recovery.


provisionedThroughput?

Type: IResolvable | ProvisionedThroughputProperty (optional)

Throughput for the specified table, which consists of values for ReadCapacityUnits and WriteCapacityUnits .

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.


sseSpecification?

Type: IResolvable | SSESpecificationProperty (optional)

Specifies the settings to enable server-side encryption.


streamSpecification?

Type: IResolvable | StreamSpecificationProperty (optional)

The settings for the DynamoDB table stream, which capture changes to items stored in the table.


tableClass?

Type: string (optional)

The table class of the new table.

Valid values are STANDARD and STANDARD_INFREQUENT_ACCESS .


tableName?

Type: string (optional)

A name for the table.

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.


timeToLiveSpecification?

Type: IResolvable | TimeToLiveSpecificationProperty (optional)

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.


static CFN_RESOURCE_TYPE_NAME

Type: string

The CloudFormation resource type name for this resource class.

Methods

NameDescription
addDeletionOverride(path)Syntactic sugar for addOverride(path, undefined).
addDependency(target)Indicates that this resource depends on another resource and cannot be provisioned unless the other resource has been successfully provisioned.
addDependsOn(target)⚠️Indicates that this resource depends on another resource and cannot be provisioned unless the other resource has been successfully provisioned.
addMetadata(key, value)Add a value to the CloudFormation Resource Metadata.
addOverride(path, value)Adds an override to the synthesized CloudFormation resource.
addPropertyDeletionOverride(propertyPath)Adds an override that deletes the value of a property from the resource definition.
addPropertyOverride(propertyPath, value)Adds an override to a resource property.
applyRemovalPolicy(policy?, options?)Sets the deletion policy of the resource based on the removal policy specified.
getAtt(attributeName, typeHint?)Returns a token for an runtime attribute of this resource.
getMetadata(key)Retrieve a value value from the CloudFormation Resource Metadata.
inspect(inspector)Examines the CloudFormation resource and discloses attributes.
obtainDependencies()Retrieves an array of resources this resource depends on.
obtainResourceDependencies()Get a shallow copy of dependencies between this resource and other resources in the same stack.
overrideLogicalId(newLogicalId)Overrides the auto-generated logical ID with a specific ID.
removeDependency(target)Indicates that this resource no longer depends on another resource.
replaceDependency(target, newTarget)Replaces one dependency with another.
toString()Returns a string representation of this construct.
protected renderProperties(props)

addDeletionOverride(path)

public addDeletionOverride(path: string): void

Parameters

  • path string — The path of the value to delete.

Syntactic sugar for addOverride(path, undefined).


addDependency(target)

public addDependency(target: CfnResource): void

Parameters

  • target CfnResource

Indicates that this resource depends on another resource and cannot be provisioned unless the other resource has been successfully provisioned.

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


addDependsOn(target)⚠️

public addDependsOn(target: CfnResource): void

⚠️ Deprecated: use addDependency

Parameters

  • target CfnResource

Indicates that this resource depends on another resource and cannot be provisioned unless the other resource has been successfully provisioned.


addMetadata(key, value)

public addMetadata(key: string, value: any): void

Parameters

  • key string
  • value any

Add a value to the CloudFormation Resource Metadata.

See also: [https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/metadata-section-structure.html

Note that this is a different set of metadata from CDK node metadata; this metadata ends up in the stack template under the resource, whereas CDK node metadata ends up in the Cloud Assembly.](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/metadata-section-structure.html

Note that this is a different set of metadata from CDK node metadata; this metadata ends up in the stack template under the resource, whereas CDK node metadata ends up in the Cloud Assembly.)


addOverride(path, value)

public addOverride(path: string, value: any): void

Parameters

  • path string — - The path of the property, you can use dot notation to override values in complex types.
  • value any — - The value.

Adds an override to the synthesized CloudFormation resource.

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,

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

would add the overrides

"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.


addPropertyDeletionOverride(propertyPath)

public addPropertyDeletionOverride(propertyPath: string): void

Parameters

  • propertyPath string — The path to the property.

Adds an override that deletes the value of a property from the resource definition.


addPropertyOverride(propertyPath, value)

public addPropertyOverride(propertyPath: string, value: any): void

Parameters

  • propertyPath string — The path of the property.
  • value any — The value.

Adds an override to a resource property.

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


applyRemovalPolicy(policy?, options?)

public applyRemovalPolicy(policy?: RemovalPolicy, options?: RemovalPolicyOptions): void

Parameters

  • policy RemovalPolicy
  • options RemovalPolicyOptions

Sets the deletion policy of the resource based on the removal policy specified.

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:

See also: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-deletionpolicy.html#aws-attribute-deletionpolicy-options


getAtt(attributeName, typeHint?)

public getAtt(attributeName: string, typeHint?: ResolutionTypeHint): Reference

Parameters

  • attributeName string — The name of the attribute.
  • typeHint ResolutionTypeHint

Returns

  • 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.


getMetadata(key)

public getMetadata(key: string): any

Parameters

  • key string

Returns

  • any

Retrieve a value value from the CloudFormation Resource Metadata.

See also: [https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/metadata-section-structure.html

Note that this is a different set of metadata from CDK node metadata; this metadata ends up in the stack template under the resource, whereas CDK node metadata ends up in the Cloud Assembly.](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/metadata-section-structure.html

Note that this is a different set of metadata from CDK node metadata; this metadata ends up in the stack template under the resource, whereas CDK node metadata ends up in the Cloud Assembly.)


inspect(inspector)

public inspect(inspector: TreeInspector): void

Parameters

  • inspector TreeInspector — - tree inspector to collect and process attributes.

Examines the CloudFormation resource and discloses attributes.


obtainDependencies()

public obtainDependencies(): Stack &#124; CfnResource[]

Returns

  • Stack | CfnResource[]

Retrieves an array of resources this resource depends on.

This assembles dependencies on resources across stacks (including nested stacks) automatically.


obtainResourceDependencies()

public obtainResourceDependencies(): CfnResource[]

Returns

  • CfnResource[]

Get a shallow copy of dependencies between this resource and other resources in the same stack.


overrideLogicalId(newLogicalId)

public overrideLogicalId(newLogicalId: string): void

Parameters

  • newLogicalId string — The new logical ID to use for this stack element.

Overrides the auto-generated logical ID with a specific ID.


removeDependency(target)

public removeDependency(target: CfnResource): void

Parameters

  • 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, newTarget)

public replaceDependency(target: CfnResource, newTarget: CfnResource): void

Parameters

  • target CfnResource — The dependency to replace.
  • newTarget CfnResource — The new dependency to add.

Replaces one dependency with another.


toString()

public toString(): string

Returns

  • string

Returns a string representation of this construct.


protected renderProperties(props)

protected renderProperties(props: { [string]: any }): { [string]: any }

Parameters

  • props { [string]: any }

Returns

  • { [string]: any }