Class CfnGlobalTable
- All Implemented Interfaces:
IInspectable
,software.amazon.jsii.JsiiSerializable
,software.constructs.IConstruct
,software.constructs.IDependable
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 typeAWS::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 viaAWS::ApplicationAutoScaling::ScalableTarget
orAWS::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 yourAWS::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 .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()) .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:
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
Represents an attribute for describing the schema for the table and indexes.static final class
A fluent builder forCfnGlobalTable
.static interface
Configures a scalable target and an autoscaling policy for a table or global secondary index's read or write capacity.static interface
Configures contributor insights settings for a replica or one of its indexes.static interface
Allows you to specify a global secondary index for the global table.static interface
Represents a single element of a key schema.static interface
The Kinesis Data Streams configuration for the specified global table replica.static interface
Represents the properties of a local secondary index.static interface
Represents the settings used to enable point in time recovery.static interface
Represents attributes that are copied (projected) from the table into an index.static interface
Sets the read request settings for a replica table or a replica global secondary index.static interface
Allows you to specify the read capacity settings for a replica table or a replica global secondary index when theBillingMode
is set toPROVISIONED
.static interface
Represents the properties of a global secondary index that can be set on a per-replica basis.static interface
Defines settings specific to a single replica of a global table.static interface
Allows you to specify a KMS key identifier to be used for server-side encryption.static interface
Represents the DynamoDB Streams configuration for a global table replica.static interface
Creates or updates a resource-based policy document that contains the permissions for DynamoDB resources, such as a table, its indexes, and stream.static interface
Represents the settings used to enable server-side encryption.static interface
Represents the DynamoDB Streams configuration for a table in DynamoDB.static interface
Defines a target tracking scaling policy.static interface
Represents the settings used to enable or disable Time to Live (TTL) for the specified table.static interface
Sets the write request settings for a global table or a global secondary index.static interface
Specifies an auto scaling policy for write capacity.Nested classes/interfaces inherited from class software.amazon.jsii.JsiiObject
software.amazon.jsii.JsiiObject.InitializationMode
Nested classes/interfaces inherited from interface software.constructs.IConstruct
software.constructs.IConstruct.Jsii$Default
Nested classes/interfaces inherited from interface software.amazon.awscdk.IInspectable
IInspectable.Jsii$Default, IInspectable.Jsii$Proxy
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
The CloudFormation resource type name for this resource class. -
Constructor Summary
ModifierConstructorDescriptionprotected
CfnGlobalTable
(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) protected
CfnGlobalTable
(software.amazon.jsii.JsiiObjectRef objRef) CfnGlobalTable
(software.constructs.Construct scope, String id, CfnGlobalTableProps props) -
Method Summary
Modifier and TypeMethodDescriptionThe Amazon Resource Name (ARN) of the DynamoDB table, such asarn:aws:dynamodb:us-east-2:123456789012:table/myDynamoDBTable
.A list of attributes that describe the key schema for the global table and indexes.The ARN of the DynamoDB stream, such asarn:aws:dynamodb:us-east-1:123456789012:table/testddbstack-myDynamoDBTable-012A1SL7SMP5Q/stream/2015-11-30T20:10:00.000
.Unique identifier for the table, such asa123b456-01ab-23cd-123a-111222aaabbb
.Specifies how you are charged for read and write throughput and how you manage capacity.Global secondary indexes to be created on the global table.Specifies the attributes that make up the primary key for the table.Local secondary indexes to be created on the table.Specifies the list of replicas for your global table.Specifies the settings to enable server-side encryption.Specifies the streams settings on your global table.A name for the global table.Specifies the time to live (TTL) settings for the table.Sets the write request settings for a global table or a global secondary index.Specifies an auto scaling policy for write capacity.void
inspect
(TreeInspector inspector) Examines the CloudFormation resource and discloses attributes.renderProperties
(Map<String, Object> props) void
setAttributeDefinitions
(List<Object> value) A list of attributes that describe the key schema for the global table and indexes.void
A list of attributes that describe the key schema for the global table and indexes.void
setBillingMode
(String value) Specifies how you are charged for read and write throughput and how you manage capacity.void
setGlobalSecondaryIndexes
(List<Object> value) Global secondary indexes to be created on the global table.void
Global secondary indexes to be created on the global table.void
setKeySchema
(List<Object> value) Specifies the attributes that make up the primary key for the table.void
setKeySchema
(IResolvable value) Specifies the attributes that make up the primary key for the table.void
setLocalSecondaryIndexes
(List<Object> value) Local secondary indexes to be created on the table.void
Local secondary indexes to be created on the table.void
setReplicas
(List<Object> value) Specifies the list of replicas for your global table.void
setReplicas
(IResolvable value) Specifies the list of replicas for your global table.void
setSseSpecification
(IResolvable value) Specifies the settings to enable server-side encryption.void
Specifies the settings to enable server-side encryption.void
Specifies the streams settings on your global table.void
Specifies the streams settings on your global table.void
setTableName
(String value) A name for the global table.void
Specifies the time to live (TTL) settings for the table.void
Specifies the time to live (TTL) settings for the table.void
Sets the write request settings for a global table or a global secondary index.void
Sets the write request settings for a global table or a global secondary index.void
Specifies an auto scaling policy for write capacity.void
setWriteProvisionedThroughputSettings
(CfnGlobalTable.WriteProvisionedThroughputSettingsProperty value) Specifies an auto scaling policy for write capacity.Methods inherited from class software.amazon.awscdk.CfnResource
addDeletionOverride, addDependency, addDependsOn, addMetadata, addOverride, addPropertyDeletionOverride, addPropertyOverride, applyRemovalPolicy, applyRemovalPolicy, applyRemovalPolicy, getAtt, getAtt, getCfnOptions, getCfnResourceType, getMetadata, getUpdatedProperites, getUpdatedProperties, isCfnResource, obtainDependencies, obtainResourceDependencies, removeDependency, replaceDependency, shouldSynthesize, toString, validateProperties
Methods inherited from class software.amazon.awscdk.CfnRefElement
getRef
Methods inherited from class software.amazon.awscdk.CfnElement
getCreationStack, getLogicalId, getStack, isCfnElement, overrideLogicalId
Methods inherited from class software.constructs.Construct
getNode, isConstruct
Methods inherited from class software.amazon.jsii.JsiiObject
jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSet
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Field Details
-
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
Examines the CloudFormation resource and discloses attributes.- Specified by:
inspect
in interfaceIInspectable
- 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 classCfnResource
- Parameters:
props
- This parameter is required.
-
getAttrArn
The Amazon Resource Name (ARN) of the DynamoDB table, such asarn: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
The ARN of the DynamoDB stream, such asarn:aws:dynamodb:us-east-1:123456789012:table/testddbstack-myDynamoDBTable-012A1SL7SMP5Q/stream/2015-11-30T20:10:00.000
. TheStreamArn
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
Unique identifier for the table, such asa123b456-01ab-23cd-123a-111222aaabbb
.The
TableId
returned is that of the replica in the region the stack is deployed to. -
getCfnProperties
- Overrides:
getCfnProperties
in classCfnResource
-
getAttributeDefinitions
A list of attributes that describe the key schema for the global table and indexes. -
setAttributeDefinitions
A list of attributes that describe the key schema for the global table and indexes. -
setAttributeDefinitions
A list of attributes that describe the key schema for the global table and indexes. -
getKeySchema
Specifies the attributes that make up the primary key for the table. -
setKeySchema
Specifies the attributes that make up the primary key for the table. -
setKeySchema
Specifies the attributes that make up the primary key for the table. -
getReplicas
Specifies the list of replicas for your global table. -
setReplicas
Specifies the list of replicas for your global table. -
setReplicas
Specifies the list of replicas for your global table. -
getBillingMode
Specifies how you are charged for read and write throughput and how you manage capacity.Valid values are:.
-
setBillingMode
Specifies how you are charged for read and write throughput and how you manage capacity.Valid values are:.
-
getGlobalSecondaryIndexes
Global secondary indexes to be created on the global table. -
setGlobalSecondaryIndexes
Global secondary indexes to be created on the global table. -
setGlobalSecondaryIndexes
Global secondary indexes to be created on the global table. -
getLocalSecondaryIndexes
Local secondary indexes to be created on the table. -
setLocalSecondaryIndexes
Local secondary indexes to be created on the table. -
setLocalSecondaryIndexes
Local secondary indexes to be created on the table. -
getSseSpecification
Specifies the settings to enable server-side encryption. -
setSseSpecification
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
Specifies the streams settings on your global table. -
setStreamSpecification
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
A name for the global table. -
setTableName
A name for the global table. -
getTimeToLiveSpecification
Specifies the time to live (TTL) settings for the table. -
setTimeToLiveSpecification
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. -
getWriteOnDemandThroughputSettings
Sets the write request settings for a global table or a global secondary index. -
setWriteOnDemandThroughputSettings
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
Specifies an auto scaling policy for write capacity. -
setWriteProvisionedThroughputSettings
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.
-