Class CfnGlobalTable

java.lang.Object
software.amazon.jsii.JsiiObject
software.constructs.Construct
All Implemented Interfaces:
IInspectable, software.amazon.jsii.JsiiSerializable, software.constructs.IConstruct, software.constructs.IDependable

@Generated(value="jsii-pacmak/1.104.0 (build e79254c)", date="2024-11-22T02:23:59.978Z") @Stability(Stable) public class CfnGlobalTable extends CfnResource implements IInspectable
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: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 software.amazon.awscdk.services.dynamodb.*;
 Object policyDocument;
 CfnGlobalTable cfnGlobalTable = CfnGlobalTable.Builder.create(this, "MyCfnGlobalTable")
         .attributeDefinitions(List.of(AttributeDefinitionProperty.builder()
                 .attributeName("attributeName")
                 .attributeType("attributeType")
                 .build()))
         .keySchema(List.of(KeySchemaProperty.builder()
                 .attributeName("attributeName")
                 .keyType("keyType")
                 .build()))
         .replicas(List.of(ReplicaSpecificationProperty.builder()
                 .region("region")
                 // the properties below are optional
                 .contributorInsightsSpecification(ContributorInsightsSpecificationProperty.builder()
                         .enabled(false)
                         .build())
                 .deletionProtectionEnabled(false)
                 .globalSecondaryIndexes(List.of(ReplicaGlobalSecondaryIndexSpecificationProperty.builder()
                         .indexName("indexName")
                         // the properties below are optional
                         .contributorInsightsSpecification(ContributorInsightsSpecificationProperty.builder()
                                 .enabled(false)
                                 .build())
                         .readOnDemandThroughputSettings(ReadOnDemandThroughputSettingsProperty.builder()
                                 .maxReadRequestUnits(123)
                                 .build())
                         .readProvisionedThroughputSettings(ReadProvisionedThroughputSettingsProperty.builder()
                                 .readCapacityAutoScalingSettings(CapacityAutoScalingSettingsProperty.builder()
                                         .maxCapacity(123)
                                         .minCapacity(123)
                                         .targetTrackingScalingPolicyConfiguration(TargetTrackingScalingPolicyConfigurationProperty.builder()
                                                 .targetValue(123)
                                                 // the properties below are optional
                                                 .disableScaleIn(false)
                                                 .scaleInCooldown(123)
                                                 .scaleOutCooldown(123)
                                                 .build())
                                         // the properties below are optional
                                         .seedCapacity(123)
                                         .build())
                                 .readCapacityUnits(123)
                                 .build())
                         .build()))
                 .kinesisStreamSpecification(KinesisStreamSpecificationProperty.builder()
                         .streamArn("streamArn")
                         // the properties below are optional
                         .approximateCreationDateTimePrecision("approximateCreationDateTimePrecision")
                         .build())
                 .pointInTimeRecoverySpecification(PointInTimeRecoverySpecificationProperty.builder()
                         .pointInTimeRecoveryEnabled(false)
                         .build())
                 .readOnDemandThroughputSettings(ReadOnDemandThroughputSettingsProperty.builder()
                         .maxReadRequestUnits(123)
                         .build())
                 .readProvisionedThroughputSettings(ReadProvisionedThroughputSettingsProperty.builder()
                         .readCapacityAutoScalingSettings(CapacityAutoScalingSettingsProperty.builder()
                                 .maxCapacity(123)
                                 .minCapacity(123)
                                 .targetTrackingScalingPolicyConfiguration(TargetTrackingScalingPolicyConfigurationProperty.builder()
                                         .targetValue(123)
                                         // the properties below are optional
                                         .disableScaleIn(false)
                                         .scaleInCooldown(123)
                                         .scaleOutCooldown(123)
                                         .build())
                                 // the properties below are optional
                                 .seedCapacity(123)
                                 .build())
                         .readCapacityUnits(123)
                         .build())
                 .replicaStreamSpecification(ReplicaStreamSpecificationProperty.builder()
                         .resourcePolicy(ResourcePolicyProperty.builder()
                                 .policyDocument(policyDocument)
                                 .build())
                         .build())
                 .resourcePolicy(ResourcePolicyProperty.builder()
                         .policyDocument(policyDocument)
                         .build())
                 .sseSpecification(ReplicaSSESpecificationProperty.builder()
                         .kmsMasterKeyId("kmsMasterKeyId")
                         .build())
                 .tableClass("tableClass")
                 .tags(List.of(CfnTag.builder()
                         .key("key")
                         .value("value")
                         .build()))
                 .build()))
         // the properties below are optional
         .billingMode("billingMode")
         .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
                 .warmThroughput(WarmThroughputProperty.builder()
                         .readUnitsPerSecond(123)
                         .writeUnitsPerSecond(123)
                         .build())
                 .writeOnDemandThroughputSettings(WriteOnDemandThroughputSettingsProperty.builder()
                         .maxWriteRequestUnits(123)
                         .build())
                 .writeProvisionedThroughputSettings(WriteProvisionedThroughputSettingsProperty.builder()
                         .writeCapacityAutoScalingSettings(CapacityAutoScalingSettingsProperty.builder()
                                 .maxCapacity(123)
                                 .minCapacity(123)
                                 .targetTrackingScalingPolicyConfiguration(TargetTrackingScalingPolicyConfigurationProperty.builder()
                                         .targetValue(123)
                                         // the properties below are optional
                                         .disableScaleIn(false)
                                         .scaleInCooldown(123)
                                         .scaleOutCooldown(123)
                                         .build())
                                 // the properties below are optional
                                 .seedCapacity(123)
                                 .build())
                         .build())
                 .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()))
         .sseSpecification(SSESpecificationProperty.builder()
                 .sseEnabled(false)
                 // the properties below are optional
                 .sseType("sseType")
                 .build())
         .streamSpecification(StreamSpecificationProperty.builder()
                 .streamViewType("streamViewType")
                 .build())
         .tableName("tableName")
         .timeToLiveSpecification(TimeToLiveSpecificationProperty.builder()
                 .enabled(false)
                 // the properties below are optional
                 .attributeName("attributeName")
                 .build())
         .warmThroughput(WarmThroughputProperty.builder()
                 .readUnitsPerSecond(123)
                 .writeUnitsPerSecond(123)
                 .build())
         .writeOnDemandThroughputSettings(WriteOnDemandThroughputSettingsProperty.builder()
                 .maxWriteRequestUnits(123)
                 .build())
         .writeProvisionedThroughputSettings(WriteProvisionedThroughputSettingsProperty.builder()
                 .writeCapacityAutoScalingSettings(CapacityAutoScalingSettingsProperty.builder()
                         .maxCapacity(123)
                         .minCapacity(123)
                         .targetTrackingScalingPolicyConfiguration(TargetTrackingScalingPolicyConfigurationProperty.builder()
                                 .targetValue(123)
                                 // the properties below are optional
                                 .disableScaleIn(false)
                                 .scaleInCooldown(123)
                                 .scaleOutCooldown(123)
                                 .build())
                         // the properties below are optional
                         .seedCapacity(123)
                         .build())
                 .build())
         .build();
 

See Also:
  • Field Details

    • CFN_RESOURCE_TYPE_NAME

      @Stability(Stable) public static final String CFN_RESOURCE_TYPE_NAME
      The CloudFormation resource type name for this resource class.
  • Constructor Details

    • CfnGlobalTable

      protected CfnGlobalTable(software.amazon.jsii.JsiiObjectRef objRef)
    • CfnGlobalTable

      protected CfnGlobalTable(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
    • CfnGlobalTable

      @Stability(Stable) public CfnGlobalTable(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull CfnGlobalTableProps props)
      Parameters:
      scope - Scope in which this resource is defined. This parameter is required.
      id - Construct identifier for this resource (unique in its scope). This parameter is required.
      props - Resource properties. This parameter is required.
  • Method Details

    • inspect

      @Stability(Stable) public void inspect(@NotNull TreeInspector inspector)
      Examines the CloudFormation resource and discloses attributes.

      Specified by:
      inspect in interface IInspectable
      Parameters:
      inspector - tree inspector to collect and process attributes. This parameter is required.
    • renderProperties

      @Stability(Stable) @NotNull protected Map<String,Object> renderProperties(@NotNull Map<String,Object> props)
      Overrides:
      renderProperties in class CfnResource
      Parameters:
      props - This parameter is required.
    • getAttrArn

      @Stability(Stable) @NotNull public String getAttrArn()
      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.

    • getAttrStreamArn

      @Stability(Stable) @NotNull public String getAttrStreamArn()
      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.

    • getAttrTableId

      @Stability(Stable) @NotNull public String getAttrTableId()
      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.

    • getCfnProperties

      @Stability(Stable) @NotNull protected Map<String,Object> getCfnProperties()
      Overrides:
      getCfnProperties in class CfnResource
    • getAttributeDefinitions

      @Stability(Stable) @NotNull public Object getAttributeDefinitions()
      A list of attributes that describe the key schema for the global table and indexes.
    • setAttributeDefinitions

      @Stability(Stable) public void setAttributeDefinitions(@NotNull IResolvable value)
      A list of attributes that describe the key schema for the global table and indexes.
    • setAttributeDefinitions

      @Stability(Stable) public void setAttributeDefinitions(@NotNull List<Object> value)
      A list of attributes that describe the key schema for the global table and indexes.
    • getKeySchema

      @Stability(Stable) @NotNull public Object getKeySchema()
      Specifies the attributes that make up the primary key for the table.
    • setKeySchema

      @Stability(Stable) public void setKeySchema(@NotNull IResolvable value)
      Specifies the attributes that make up the primary key for the table.
    • setKeySchema

      @Stability(Stable) public void setKeySchema(@NotNull List<Object> value)
      Specifies the attributes that make up the primary key for the table.
    • getReplicas

      @Stability(Stable) @NotNull public Object getReplicas()
      Specifies the list of replicas for your global table.
    • setReplicas

      @Stability(Stable) public void setReplicas(@NotNull IResolvable value)
      Specifies the list of replicas for your global table.
    • setReplicas

      @Stability(Stable) public void setReplicas(@NotNull List<Object> value)
      Specifies the list of replicas for your global table.
    • getBillingMode

      @Stability(Stable) @Nullable public String getBillingMode()
      Specifies how you are charged for read and write throughput and how you manage capacity.

      Valid values are:.

    • setBillingMode

      @Stability(Stable) public void setBillingMode(@Nullable String value)
      Specifies how you are charged for read and write throughput and how you manage capacity.

      Valid values are:.

    • getGlobalSecondaryIndexes

      @Stability(Stable) @Nullable public Object getGlobalSecondaryIndexes()
      Global secondary indexes to be created on the global table.
    • setGlobalSecondaryIndexes

      @Stability(Stable) public void setGlobalSecondaryIndexes(@Nullable IResolvable value)
      Global secondary indexes to be created on the global table.
    • setGlobalSecondaryIndexes

      @Stability(Stable) public void setGlobalSecondaryIndexes(@Nullable List<Object> value)
      Global secondary indexes to be created on the global table.
    • getLocalSecondaryIndexes

      @Stability(Stable) @Nullable public Object getLocalSecondaryIndexes()
      Local secondary indexes to be created on the table.
    • setLocalSecondaryIndexes

      @Stability(Stable) public void setLocalSecondaryIndexes(@Nullable IResolvable value)
      Local secondary indexes to be created on the table.
    • setLocalSecondaryIndexes

      @Stability(Stable) public void setLocalSecondaryIndexes(@Nullable List<Object> value)
      Local secondary indexes to be created on the table.
    • getSseSpecification

      @Stability(Stable) @Nullable public Object getSseSpecification()
      Specifies the settings to enable server-side encryption.
    • setSseSpecification

      @Stability(Stable) public void setSseSpecification(@Nullable IResolvable value)
      Specifies the settings to enable server-side encryption.
    • setSseSpecification

      @Stability(Stable) public void setSseSpecification(@Nullable CfnGlobalTable.SSESpecificationProperty value)
      Specifies the settings to enable server-side encryption.
    • getStreamSpecification

      @Stability(Stable) @Nullable public Object getStreamSpecification()
      Specifies the streams settings on your global table.
    • setStreamSpecification

      @Stability(Stable) public void setStreamSpecification(@Nullable IResolvable value)
      Specifies the streams settings on your global table.
    • setStreamSpecification

      @Stability(Stable) public void setStreamSpecification(@Nullable CfnGlobalTable.StreamSpecificationProperty value)
      Specifies the streams settings on your global table.
    • getTableName

      @Stability(Stable) @Nullable public String getTableName()
      A name for the global table.
    • setTableName

      @Stability(Stable) public void setTableName(@Nullable String value)
      A name for the global table.
    • getTimeToLiveSpecification

      @Stability(Stable) @Nullable public Object getTimeToLiveSpecification()
      Specifies the time to live (TTL) settings for the table.
    • setTimeToLiveSpecification

      @Stability(Stable) public void setTimeToLiveSpecification(@Nullable IResolvable value)
      Specifies the time to live (TTL) settings for the table.
    • setTimeToLiveSpecification

      @Stability(Stable) public void setTimeToLiveSpecification(@Nullable CfnGlobalTable.TimeToLiveSpecificationProperty value)
      Specifies the time to live (TTL) settings for the table.
    • getWarmThroughput

      @Stability(Stable) @Nullable public Object getWarmThroughput()
      Provides visibility into the number of read and write operations your table or secondary index can instantaneously support.
    • setWarmThroughput

      @Stability(Stable) public void setWarmThroughput(@Nullable IResolvable value)
      Provides visibility into the number of read and write operations your table or secondary index can instantaneously support.
    • setWarmThroughput

      @Stability(Stable) public void setWarmThroughput(@Nullable CfnGlobalTable.WarmThroughputProperty value)
      Provides visibility into the number of read and write operations your table or secondary index can instantaneously support.
    • getWriteOnDemandThroughputSettings

      @Stability(Stable) @Nullable public Object getWriteOnDemandThroughputSettings()
      Sets the write request settings for a global table or a global secondary index.
    • setWriteOnDemandThroughputSettings

      @Stability(Stable) public void setWriteOnDemandThroughputSettings(@Nullable IResolvable value)
      Sets the write request settings for a global table or a global secondary index.
    • setWriteOnDemandThroughputSettings

      @Stability(Stable) public void setWriteOnDemandThroughputSettings(@Nullable CfnGlobalTable.WriteOnDemandThroughputSettingsProperty value)
      Sets the write request settings for a global table or a global secondary index.
    • getWriteProvisionedThroughputSettings

      @Stability(Stable) @Nullable public Object getWriteProvisionedThroughputSettings()
      Specifies an auto scaling policy for write capacity.
    • setWriteProvisionedThroughputSettings

      @Stability(Stable) public void setWriteProvisionedThroughputSettings(@Nullable IResolvable value)
      Specifies an auto scaling policy for write capacity.
    • setWriteProvisionedThroughputSettings

      @Stability(Stable) public void setWriteProvisionedThroughputSettings(@Nullable CfnGlobalTable.WriteProvisionedThroughputSettingsProperty value)
      Specifies an auto scaling policy for write capacity.