aws-cdk-lib.aws_dynamodb.CfnGlobalTable

class CfnGlobalTable (construct)

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

Implements IConstruct, IDependable, IInspectable

A CloudFormation AWS::DynamoDB::GlobalTable.

The AWS::DynamoDB::GlobalTable resource enables you to create and manage a Version 2019.11.21 global table. This resource cannot be used to create or manage a Version 2017.11.29 global table. For more information, see Global tables .

You cannot convert a resource of type AWS::DynamoDB::Table into a resource of type AWS::DynamoDB::GlobalTable by changing its type in your template. Doing so might result in the deletion of your DynamoDB table.

You can instead use the GlobalTable resource to create a new table in a single Region. This will be billed the same as a single Region table. If you later update the stack to add other Regions then Global Tables pricing will apply.

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

  • The IAM Principal executing the stack operation must have the permissions listed below in all regions where you plan to have a global table replica. The IAM Principal's permissions should not have restrictions based on IP source address. Some global tables operations (for example, adding a replica) are asynchronous, and require that the IAM Principal is valid until they complete. You should not delete the Principal (user or IAM role) until CloudFormation has finished updating your stack.

  • dynamodb:CreateTable

  • dynamodb:UpdateTable

  • dynamodb:DeleteTable

  • dynamodb:DescribeContinuousBackups

  • dynamodb:DescribeContributorInsights

  • dynamodb:DescribeTable

  • dynamodb:DescribeTableReplicaAutoScaling

  • dynamodb:DescribeTimeToLive

  • dynamodb:ListTables

  • dynamodb:UpdateTimeToLive

  • dynamodb:UpdateContributorInsights

  • dynamodb:UpdateContinuousBackups

  • dynamodb:ListTagsOfResource

  • dynamodb:TableClass

  • dynamodb:TagResource

  • dynamodb:UntagResource

  • dynamodb:BatchWriteItem

  • dynamodb:CreateTableReplica

  • dynamodb:DeleteItem

  • dynamodb:DeleteTableReplica

  • dynamodb:DisableKinesisStreamingDestination

  • dynamodb:EnableKinesisStreamingDestination

  • dynamodb:GetItem

  • dynamodb:PutItem

  • dynamodb:Query

  • dynamodb:Scan

  • dynamodb:UpdateItem

  • dynamodb:DescribeTableReplicaAutoScaling

  • dynamodb:UpdateTableReplicaAutoScaling

  • iam:CreateServiceLinkedRole

  • kms:CreateGrant

  • kms:DescribeKey

  • application-autoscaling:DeleteScalingPolicy

  • application-autoscaling:DeleteScheduledAction

  • application-autoscaling:DeregisterScalableTarget

  • application-autoscaling:DescribeScalingPolicies

  • application-autoscaling:DescribeScalableTargets

  • application-autoscaling:PutScalingPolicy

  • application-autoscaling:PutScheduledAction

  • application-autoscaling:RegisterScalableTarget

  • When using provisioned billing mode, CloudFormation will create an auto scaling policy on each of your replicas to control their write capacities. You must configure this policy using the WriteProvisionedThroughputSettings property. CloudFormation will ensure that all replicas have the same write capacity auto scaling property. You cannot directly specify a value for write capacity for a global table.

  • If your table uses provisioned capacity, you must configure auto scaling directly in the AWS::DynamoDB::GlobalTable resource. You should not configure additional auto scaling policies on any of the table replicas or global secondary indexes, either via API or via AWS::ApplicationAutoScaling::ScalableTarget or AWS::ApplicationAutoScaling::ScalingPolicy . Doing so might result in unexpected behavior and is unsupported.

  • In AWS CloudFormation , each global table is controlled by a single stack, in a single region, regardless of the number of replicas. When you deploy your template, CloudFormation will create/update all replicas as part of a single stack operation. You should not deploy the same AWS::DynamoDB::GlobalTable resource in multiple regions. Doing so will result in errors, and is unsupported. If you deploy your application template in multiple regions, you can use conditions to only create the resource in a single region. Alternatively, you can choose to define your AWS::DynamoDB::GlobalTable resources in a stack separate from your application stack, and make sure it is only deployed to a single region.

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 cfnGlobalTable = new dynamodb.CfnGlobalTable(this, 'MyCfnGlobalTable', {
  attributeDefinitions: [{
    attributeName: 'attributeName',
    attributeType: 'attributeType',
  }],
  keySchema: [{
    attributeName: 'attributeName',
    keyType: 'keyType',
  }],
  replicas: [{
    region: 'region',

    // the properties below are optional
    contributorInsightsSpecification: {
      enabled: false,
    },
    deletionProtectionEnabled: false,
    globalSecondaryIndexes: [{
      indexName: 'indexName',

      // the properties below are optional
      contributorInsightsSpecification: {
        enabled: false,
      },
      readProvisionedThroughputSettings: {
        readCapacityAutoScalingSettings: {
          maxCapacity: 123,
          minCapacity: 123,
          targetTrackingScalingPolicyConfiguration: {
            targetValue: 123,

            // the properties below are optional
            disableScaleIn: false,
            scaleInCooldown: 123,
            scaleOutCooldown: 123,
          },

          // the properties below are optional
          seedCapacity: 123,
        },
        readCapacityUnits: 123,
      },
    }],
    kinesisStreamSpecification: {
      streamArn: 'streamArn',
    },
    pointInTimeRecoverySpecification: {
      pointInTimeRecoveryEnabled: false,
    },
    readProvisionedThroughputSettings: {
      readCapacityAutoScalingSettings: {
        maxCapacity: 123,
        minCapacity: 123,
        targetTrackingScalingPolicyConfiguration: {
          targetValue: 123,

          // the properties below are optional
          disableScaleIn: false,
          scaleInCooldown: 123,
          scaleOutCooldown: 123,
        },

        // the properties below are optional
        seedCapacity: 123,
      },
      readCapacityUnits: 123,
    },
    sseSpecification: {
      kmsMasterKeyId: 'kmsMasterKeyId',
    },
    tableClass: 'tableClass',
    tags: [{
      key: 'key',
      value: 'value',
    }],
  }],

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

    // the properties below are optional
    writeProvisionedThroughputSettings: {
      writeCapacityAutoScalingSettings: {
        maxCapacity: 123,
        minCapacity: 123,
        targetTrackingScalingPolicyConfiguration: {
          targetValue: 123,

          // the properties below are optional
          disableScaleIn: false,
          scaleInCooldown: 123,
          scaleOutCooldown: 123,
        },

        // the properties below are optional
        seedCapacity: 123,
      },
    },
  }],
  localSecondaryIndexes: [{
    indexName: 'indexName',
    keySchema: [{
      attributeName: 'attributeName',
      keyType: 'keyType',
    }],
    projection: {
      nonKeyAttributes: ['nonKeyAttributes'],
      projectionType: 'projectionType',
    },
  }],
  sseSpecification: {
    sseEnabled: false,

    // the properties below are optional
    sseType: 'sseType',
  },
  streamSpecification: {
    streamViewType: 'streamViewType',
  },
  tableName: 'tableName',
  timeToLiveSpecification: {
    enabled: false,

    // the properties below are optional
    attributeName: 'attributeName',
  },
  writeProvisionedThroughputSettings: {
    writeCapacityAutoScalingSettings: {
      maxCapacity: 123,
      minCapacity: 123,
      targetTrackingScalingPolicyConfiguration: {
        targetValue: 123,

        // the properties below are optional
        disableScaleIn: false,
        scaleInCooldown: 123,
        scaleOutCooldown: 123,
      },

      // the properties below are optional
      seedCapacity: 123,
    },
  },
});

Initializer

new CfnGlobalTable(scope: Construct, id: string, props: CfnGlobalTableProps)

Parameters

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

Create a new AWS::DynamoDB::GlobalTable.

Construct Props

NameTypeDescription
attributeDefinitionsIResolvable | IResolvable | AttributeDefinitionProperty[]A list of attributes that describe the key schema for the global table and indexes.
keySchemaIResolvable | IResolvable | KeySchemaProperty[]Specifies the attributes that make up the primary key for the table.
replicasIResolvable | IResolvable | ReplicaSpecificationProperty[]Specifies the list of replicas for your global table.
billingMode?stringSpecifies how you are charged for read and write throughput and how you manage capacity. Valid values are:.
globalSecondaryIndexes?IResolvable | IResolvable | GlobalSecondaryIndexProperty[]Global secondary indexes to be created on the global table.
localSecondaryIndexes?IResolvable | IResolvable | LocalSecondaryIndexProperty[]Local secondary indexes to be created on the table.
sseSpecification?IResolvable | SSESpecificationPropertySpecifies the settings to enable server-side encryption.
streamSpecification?IResolvable | StreamSpecificationPropertySpecifies the streams settings on your global table.
tableName?stringA name for the global table.
timeToLiveSpecification?IResolvable | TimeToLiveSpecificationPropertySpecifies the time to live (TTL) settings for the table.
writeProvisionedThroughputSettings?IResolvable | WriteProvisionedThroughputSettingsPropertySpecifies an auto scaling policy for write capacity.

attributeDefinitions

Type: IResolvable | IResolvable | AttributeDefinitionProperty[]

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


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.


replicas

Type: IResolvable | IResolvable | ReplicaSpecificationProperty[]

Specifies the list of replicas for your global table.

The list must contain at least one element, the region where the stack defining the global table is deployed. For example, if you define your table in a stack deployed to us-east-1, you must have an entry in Replicas with the region us-east-1. You cannot remove the replica in the stack region.

Adding a replica might take a few minutes for an empty table, or up to several hours for large tables. If you want to add or remove a replica, we recommend submitting an UpdateStack operation containing only that change.

If you add or delete a replica 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 replica, you might need to manually delete the replica.

You can create a new global table with as many replicas as needed. You can add or remove replicas after table creation, but you can only add or remove a single replica in each update.


billingMode?

Type: string (optional)

Specifies how you are charged for read and write throughput and how you manage capacity. Valid values are:.

  • PAY_PER_REQUEST
  • PROVISIONED

All replicas in your global table will have the same billing mode. If you use PROVISIONED billing mode, you must provide an auto scaling configuration via the WriteProvisionedThroughputSettings property. The default value of this property is PROVISIONED .


globalSecondaryIndexes?

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

Global secondary indexes to be created on the global table.

You can create up to 20 global secondary indexes. Each replica in your global table will have the same global secondary index settings. You can only create or delete one global secondary index in a single stack operation.

Since the backfilling of an index could take a long time, CloudFormation does not wait for the index to become active. If a stack operation rolls back, CloudFormation might not delete an index that has been added. In that case, you will need to delete the index manually.


localSecondaryIndexes?

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

Local secondary indexes to be created on the table.

You can create up to five 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. Each replica in your global table will have the same local secondary index settings.


sseSpecification?

Type: IResolvable | SSESpecificationProperty (optional)

Specifies the settings to enable server-side encryption.

These settings will be applied to all replicas. If you plan to use customer-managed KMS keys, you must provide a key for each replica using the ReplicaSpecification.ReplicaSSESpecification property.


streamSpecification?

Type: IResolvable | StreamSpecificationProperty (optional)

Specifies the streams settings on your global table.

You must provide a value for this property if your global table contains more than one replica. You can only change the streams settings if your global table has only one replica.


tableName?

Type: string (optional)

A name for the global table.

If you don't specify a name, AWS CloudFormation generates a unique ID and uses that ID as 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.

This setting will be applied to all replicas.


writeProvisionedThroughputSettings?

Type: IResolvable | WriteProvisionedThroughputSettingsProperty (optional)

Specifies an auto scaling policy for write capacity.

This policy will be applied to all replicas. This setting must be specified if BillingMode is set to PROVISIONED .

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 . The StreamArn returned is that of the replica in the region the stack is deployed to.
attrTableIdstringUnique identifier for the table, such as a123b456-01ab-23cd-123a-111222aaabbb .
attributeDefinitionsIResolvable | IResolvable | AttributeDefinitionProperty[]A list of attributes that describe the key schema for the global table and indexes.
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.
replicasIResolvable | IResolvable | ReplicaSpecificationProperty[]Specifies the list of replicas for your global table.
stackStackThe stack in which this element is defined.
billingMode?stringSpecifies how you are charged for read and write throughput and how you manage capacity. Valid values are:.
globalSecondaryIndexes?IResolvable | IResolvable | GlobalSecondaryIndexProperty[]Global secondary indexes to be created on the global table.
localSecondaryIndexes?IResolvable | IResolvable | LocalSecondaryIndexProperty[]Local secondary indexes to be created on the table.
sseSpecification?IResolvable | SSESpecificationPropertySpecifies the settings to enable server-side encryption.
streamSpecification?IResolvable | StreamSpecificationPropertySpecifies the streams settings on your global table.
tableName?stringA name for the global table.
timeToLiveSpecification?IResolvable | TimeToLiveSpecificationPropertySpecifies the time to live (TTL) settings for the table.
writeProvisionedThroughputSettings?IResolvable | WriteProvisionedThroughputSettingsPropertySpecifies an auto scaling policy for write capacity.
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 .

The ARN returned is that of the replica in the region the stack is deployed to.


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 . The StreamArn returned is that of the replica in the region the stack is deployed to.

You must specify the StreamSpecification property to use this attribute.


attrTableId

Type: string

Unique identifier for the table, such as a123b456-01ab-23cd-123a-111222aaabbb .

The TableId returned is that of the replica in the region the stack is deployed to.


attributeDefinitions

Type: IResolvable | IResolvable | AttributeDefinitionProperty[]

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


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


replicas

Type: IResolvable | IResolvable | ReplicaSpecificationProperty[]

Specifies the list of replicas for your global table.

The list must contain at least one element, the region where the stack defining the global table is deployed. For example, if you define your table in a stack deployed to us-east-1, you must have an entry in Replicas with the region us-east-1. You cannot remove the replica in the stack region.

Adding a replica might take a few minutes for an empty table, or up to several hours for large tables. If you want to add or remove a replica, we recommend submitting an UpdateStack operation containing only that change.

If you add or delete a replica 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 replica, you might need to manually delete the replica.

You can create a new global table with as many replicas as needed. You can add or remove replicas after table creation, but you can only add or remove a single replica in each update.


stack

Type: Stack

The stack in which this element is defined.

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


billingMode?

Type: string (optional)

Specifies how you are charged for read and write throughput and how you manage capacity. Valid values are:.

  • PAY_PER_REQUEST
  • PROVISIONED

All replicas in your global table will have the same billing mode. If you use PROVISIONED billing mode, you must provide an auto scaling configuration via the WriteProvisionedThroughputSettings property. The default value of this property is PROVISIONED .


globalSecondaryIndexes?

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

Global secondary indexes to be created on the global table.

You can create up to 20 global secondary indexes. Each replica in your global table will have the same global secondary index settings. You can only create or delete one global secondary index in a single stack operation.

Since the backfilling of an index could take a long time, CloudFormation does not wait for the index to become active. If a stack operation rolls back, CloudFormation might not delete an index that has been added. In that case, you will need to delete the index manually.


localSecondaryIndexes?

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

Local secondary indexes to be created on the table.

You can create up to five 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. Each replica in your global table will have the same local secondary index settings.


sseSpecification?

Type: IResolvable | SSESpecificationProperty (optional)

Specifies the settings to enable server-side encryption.

These settings will be applied to all replicas. If you plan to use customer-managed KMS keys, you must provide a key for each replica using the ReplicaSpecification.ReplicaSSESpecification property.


streamSpecification?

Type: IResolvable | StreamSpecificationProperty (optional)

Specifies the streams settings on your global table.

You must provide a value for this property if your global table contains more than one replica. You can only change the streams settings if your global table has only one replica.


tableName?

Type: string (optional)

A name for the global table.

If you don't specify a name, AWS CloudFormation generates a unique ID and uses that ID as 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.

This setting will be applied to all replicas.


writeProvisionedThroughputSettings?

Type: IResolvable | WriteProvisionedThroughputSettingsProperty (optional)

Specifies an auto scaling policy for write capacity.

This policy will be applied to all replicas. This setting must be specified if BillingMode is set to PROVISIONED .


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 }