Yandex Cloud
Search
Contact UsGet started
  • Blog
  • Pricing
  • Documentation
  • All Services
  • System Status
    • Featured
    • Infrastructure & Network
    • Data Platform
    • Containers
    • Developer tools
    • Serverless
    • Security
    • Monitoring & Resources
    • ML & AI
    • Business tools
  • All Solutions
    • By industry
    • By use case
    • Economics and Pricing
    • Security
    • Technical Support
    • Customer Stories
    • Gateway to Russia
    • Cloud for Startups
    • Education and Science
  • Blog
  • Pricing
  • Documentation
Yandex project
© 2025 Yandex.Cloud LLC
Yandex Managed Service for YDB
  • Getting started
  • Access management
      • All methods
        • BatchGetItem
        • BatchWriteItem
        • CreateTable
        • DeleteItem
        • DeleteTable
        • DescribeTable
        • DescribeTimeToLive
        • GetItem
        • ListTables
        • PutItem
        • Query
        • Scan
        • TransactGetItems
        • TransactWriteItems
        • UpdateItem
        • UpdateTimeToLive
        • UpdateTable
    • Common errors when working with the Document API
  • Monitoring metrics
  • Audit Trails events
  • FAQ
  • Public materials

In this article:

  • Request
  • Parameters
  • Response
  • Parameters
  • Errors
  1. Amazon DynamoDB-compatible Document API
  2. Document API reference
  3. Actions
  4. CreateTable

CreateTable method

Written by
Yandex Cloud
Updated at February 26, 2024
  • Request
    • Parameters
  • Response
    • Parameters
  • Errors

Creates a new table.

The method is asynchronous.
This means it changes a table's state to CREATING and immediately returns the result. However, the table is actually being created in the background, and you can only use it after it goes ACTIVE.

RequestRequest

The request contains data in JSON format.

{
   "AttributeDefinitions": [
      {
         "AttributeName": "string",
         "AttributeType": "string"
      }
   ],
   "BillingMode": "string",
   "GlobalSecondaryIndexes": [
      {
         "IndexName": "string",
         "KeySchema": [
            {
               "AttributeName": "string",
               "KeyType": "string"
            }
         ],
         "Projection": {
            "NonKeyAttributes": [ "string" ],
            "ProjectionType": "string"
         }
      }
   ],
   "KeySchema": [
      {
         "AttributeName": "string",
         "KeyType": "string"
      }
   ],
   "StreamSpecification": {
         "StreamEnabled": boolean,
         "StreamViewType": "string"
   },
    "TableName": "string"
}

ParametersParameters

Parameter Description
AttributeDefinitions An array of attributes that describe the key schema for a table and indexes.

Type: Array of AttributeDefinition type objects
Required: Yes
GlobalSecondaryIndexes An array of attributes describing one or more global secondary indexes to be created in the table. Each item consists of:
  • IndexName is the index name. The name must be unique and at least three characters long. This is a required parameter.
  • KeySchema are the attributes that constitute the primary key of the index.
  • Projection specifies attributes that are copied from the table to the index. Currently the only supported ProjectionType is ALL.
  • NonKeyAttributes is a list of one or more non-key attribute names that are projected to the secondary index.

Required: No
KeySchema Attributes that make up the primary key. These attributes should also be specified in AttributeDefinitions.
Each item consists of:
  • AttributeName: Attribute name.
  • KeyType: Role that the key attribute will assume:
    • HASH: Partition key
    • RANGE: Sort key
For a simple primary key (partition key), specify only one attribute with the HASH role.
For a composite primary key (partition key + sort key), specify two attributes: the first one with the HASH role and the second with the RANGE role

Type: Array of KeySchemaElement type objects
Length: 1-2 items
Required: Yes
StreamSpecification Description of the update stream settings for a table:
  • StreamEnabled defines whether update streaming for the table is active or not.
  • StreamViewType defines the streaming type:
    • KEYS_ONLY: Only the primary key components and the change flag are written.
    • NEW_IMAGE: Any column values resulting from updates are written.
    • OLD_IMAGE: Any column values before updates are written.
    • NEW_AND_OLD_IMAGES: Combination of the NEW_IMAGE and OLD_IMAGE modes. Writes the values of all columns before and after the update.

  • Type: A StreamSpecification type object
    Required: No
TableName Table name.
May contain a path through the folder hierarchy in path/to/table format.

Type: String
Length: 3 - 255 characters
Pattern: [a-zA-Z0-9_.-]+
Required: Yes

ResponseResponse

If successful, HTTP code 200 is returned.
The response is returned in JSON format.

{
   "TableDescription": {
      "ArchivalSummary": {
         "ArchivalBackupArn": "string",
         "ArchivalDateTime": number,
         "ArchivalReason": "string"
      },
      "AttributeDefinitions": [
         {
            "AttributeName": "string",
            "AttributeType": "string"
         }
      ],
      "BillingModeSummary": {
         "BillingMode": "string",
         "LastUpdateToPayPerRequestDateTime": number
      },
      "CreationDateTime": number,      
      "GlobalTableVersion": "string",
      "ItemCount": number,
      "KeySchema": [
         {
            "AttributeName": "string",
            "KeyType": "string"
         }
      ],
      "LatestStreamArn": "string",
      "LatestStreamLabel": "string",     
      "Replicas": [
         {             
            "KMSMainKeyId": "string",            
            "RegionName": "string",
            "ReplicaStatus": "string",
            "ReplicaStatusDescription": "string",
            "ReplicaStatusPercentProgress": "string"
         }
      ],
      "RestoreSummary": {
         "RestoreDateTime": number,
         "RestoreInProgress": boolean,
         "SourceBackupArn": "string",
         "SourceTableArn": "string"
      },
      "SSEDescription": {
         "InaccessibleEncryptionDateTime": number,
         "KMSMainKeyArn": "string",
         "SSEType": "string",
         "Status": "string"
      },
      "StreamSpecification": {
          "StreamEnabled": boolean,
          "StreamViewType": "string"
      },
      "TableArn": "string",
      "TableId": "string",
      "TableName": "string",
      "TableSizeBytes": number,
      "TableStatus": "string"
   }
}

ParametersParameters

Parameter Description
TableDescription Properties of the created table.

Type: a TableDescription object

ErrorsErrors

Parameter Description
InternalServerError An internal error occurred on the server side.

HTTP status code: 500
LimitExceededException Table operations limit exceeded.
You can simultaneously perform up to 50 operations on tables, such as CreateTable, UpdateTable, DeleteTable, UpdateTimeToLive, RestoreTableFromBackup, and RestoreTableToPointInTime.

HTTP status code: 400
ResourceInUseException An attempt to create a table with a name that already exists.

HTTP status code: 400

There may be common errors as well. These are errors that are common to all methods.

Was the article helpful?

Previous
BatchWriteItem
Next
DeleteItem
Yandex project
© 2025 Yandex.Cloud LLC