Whatever message this page gives is out now! Go check it out!

CreateGlobalTable

Last update:
May 18, 2026

Description

The CreateGlobalTable function creates a global table from an already created table. A global table creates a replication relationship between two or more DynamoDB tables with the same table name in the provided regions.
For more information, see CreateGlobalTable.

Category

History

ColdFusion (2021 release): Added this function.

Syntax

serviceHandle.CreateGlobalTable(requestParameters)

Parameters

See parameters of CreateGlobalTable.

Example

<cfscript> 
  // configuration for first region 
  cred = { 
    "credentialAlias" : "myalias", 
    "vendorName" : "AWS", 
    "region" : "us-east-2", 
    "secretAccessKey" : "xxxxx", 
    "accessKeyId" : "xxxx" 
  } 
  config = { 
    "serviceName" = "DYNAMODB" 
  } 
  dynamoUSEast2 = getCloudService(cred, config); 
  // configuration for second region 
 cred = { 
    "credentialAlias" : "myalias", 
    "vendorName" : "AWS", 
    "region" : "us-east-1", 
    "secretAccessKey" : "xxxxx", 
    "accessKeyId" : "xxxx" 
  } 
  config = { 
    "serviceName" = "DYNAMODB" 
  } 
  dynamoUSEast1 = cloudService(cred, config); 
 
  tableName="Movies005" 
  // create table 
  tableStruct={ 
    "TableName" : "#tableName#", 
    "KeySchema":[ 
        { AttributeName: "year", KeyType: "HASH"},  //Partition key 
        { AttributeName: "title", KeyType: "RANGE"}  //Sort key 
    ], 
    "AttributeDefinitions":[ 
        { AttributeName: "year", AttributeType: "N" }, 
        { AttributeName: "title", AttributeType: "S" } 
    ], 
    "ProvisionedThroughput":{ 
        ReadCapacityUnits: 10, 
        WriteCapacityUnits: 10 
    }, 
    "StreamSpecification": { 
        "StreamEnabled": true,  // enable stream for replication 
        "StreamViewType": "NEW_AND_OLD_IMAGES" 
    } 
  } 
  // create table in both regions 
  dynamoUSEast1.createTable(tableStruct) 
  dynamoUSEast2.createTable(tableStruct) 
 
  // cred and configuration for replication 
  cred = { 
    "credentialAlias" : "myalias", 
    "vendorName" : "AWS", 
    "region" : "us-east-2", 
    "secretAccessKey" : "xxxxx", 
    "accessKeyId" : "xxxx" 
  } 
  config = { 
    "serviceName" = "DYNAMODB" 
  } 
  dynamo = cloudService(cred, config) 
 
  // create global table 
  globalTableStruct={ 
    "GlobalTableName": "#tableName#", 
    "ReplicationGroup": [ 
      { 
         "RegionName": "us-east-2" 
      }, 
      { 
         "RegionName": "us-east-1" 
      } 
   ] 
  } 
  globalTableResponse=dynamo.CreateGlobalTable(globalTableStruct) 
  writeDump(globalTableResponse) 
</cfscript>

Output

Figure: CreateGlobalTable output
CreateGlobalTable output

Share this page

Was this page helpful?
We're glad. Tell us how this page helped.
We're sorry. Can you tell us what didn't work for you?
Thank you for your feedback. Your response will help improve this page.

On this page