CreateTable

Description

The CreateTable function creates a table in your AWS account. In an AWS account, table names must be unique in each Region. You can have two tables with same name if you create the tables in different regions.

For more information, see CreateTable.

Category

History

ColdFusion (2021 release): Added this function.

Syntax

serviceHandle.createTable(requestParameters)

Parameters

See request parameters of CreateTable.

Example

<cfscript> 
  cred = { 
    "credentialAlias" : "myalias", 
    "vendorName" : "AWS", 
    "region" : "us-east-2", 
    "secretAccessKey" : "xxxxx", 
    "accessKeyId" : "xxxx" 
  } 
  config = { 
    "serviceName" = "DYNAMODB" 
  } 
  dynamo = getCloudService(cred, config) 
  // create table movies 
  tableStruct={ 
    TableName : "MoviesNew", 
    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 
    } 
 } 
  createTableResponse=dynamo.createTable(tableStruct,{"customResponse": true}) 
  writeDump(createTableResponse) 
</cfscript> 

Output

CreateTable output
CreateTable output

Get help faster and easier

New user?