ALIYUN::OTS::Table is used to create a table based on a specified schema.

Syntax

{
  "Type": "ALIYUN::OTS::Table",
  "Properties": {
    "ReservedThroughput": Map,
    "MaxVersions": Integer,
    "TableName": String,
    "SecondaryIndices": List,
    "DeviationCellVersionInSec": Integer,
    "TimeToLive": Integer,
    "InstanceName": String,
    "PrimaryKey": List,
    "Columns": List
  }
}

Properties

PropertyTypeRequiredEditableDescriptionConstraint
ReservedThroughputMapNoYesThe initial reserved read/write throughput settings of the table.The reserved read/write throughput of a table cannot exceed 5,000 per second.

For more information, see ReservedThroughput properties.

MaxVersionsIntegerNoYesThe maximum number of data versions that can be retained in the table.Valid values: 1 to 2147483647.

Default value: 1.

TableNameStringYesNoThe name of the table.None
SecondaryIndicesListNoNoThe list of one or more secondary indices of the table.For more information, see SecondaryIndices properties.
DeviationCellVersionInSecIntegerNoYesThe max version offset between a custom version number and the current system timestamp.This parameter is used to prevent users from writing data that has a custom version number beyond the valid version range. For example, if the current system timestamp is 10000 and the DeviationCellVersionInSec parameter is set to 1000, the valid version range is [10000 - 1000, 10000 + 1000).

Valid values: 1 to 9223372036854775807.

Default value: 86400.

TimeToLiveIntegerNoYesThe retention period of data stored in the table.

Maximum value: 2147483647.

Default value: 1.

Unit: seconds.

A value of -1 indicates that the data never expires.

InstanceNameStringYesNoThe name of the instance where the table resides.None
PrimaryKeyListYesNoAll primary key columns of the table.Valid values: 1 to 4.

For more information, see PrimaryKey properties.

ColumnsListNoNoThe list of one or more attribute columns of the table.For more information, see Columns properties.

ReservedThroughput syntax

"ReservedThroughput": {
  "Read": Integer,
  "Write": Integer
}

ReservedThroughput properties

PropertyTypeRequiredEditableDescriptionConstraint
ReadIntegerYesYesThe number of consumed read CUs or the reserved read throughput of the table.Default value: 0.
WriteIntegerYesYesThe number of consumed write CUs or the reserved write throughput of the table.Default value: 0.

SecondaryIndices syntax

"SecondaryIndices": [
  {
    "IndexName": String,
    "IndexType": String,
    "Columns": List,
    "PrimaryKeys": List
  }
]

SecondaryIndices properties

PropertyTypeRequiredEditableDescriptionConstraint
IndexNameStringYesNoThe name of the index.None
IndexTypeStringNoNoThe type of the index.Valid values:
  • Global
  • Local
ColumnsListYesNoThe list of one or more columns of the index.Example:
["name", "email"]
Note The property of this parameter is different from Columns properties, which indicates the list of one or more attribute columns of the table.
PrimaryKeysListYesNoThe list of one or more primary keys of the index.None

PrimaryKey syntax

"PrimaryKey": [
  {
    "Type": String,
    "Name": String
  }
]

PrimaryKey properties

PropertyTypeRequiredEditableDescriptionConstraint
TypeStringYesNoThe type of the primary key.Valid values:
  • INTEGER
  • STRING
  • BINARY
NameStringYesNoThe name of the primary key.None

Columns syntax

"Columns": [
  {
    "Type": String,
    "Name": String
  }
]

Columns properties

PropertyTypeRequiredEditableDescriptionConstraint
TypeStringYesNoThe type of the column.None
NameStringYesNoThe name of the column.None

Response parameters

Fn::GetAtt

TableName: the name of the table.

Examples

  • YAMLformat

    ROSTemplateFormatVersion: '2015-09-01'
    Parameters: {}
    Resources:
      Table:
        Type: ALIYUN::OTS::Table
        Properties:
          TableName: TestTable
          InstanceName: mytest
          PrimaryKey:
            - Type: INTEGER
              Name: id
  • JSONformat

    {
      "ROSTemplateFormatVersion": "2015-09-01",
      "Parameters": {
      },
      "Resources": {
        "Table": {
          "Type": "ALIYUN::OTS::Table",
          "Properties": {
            "TableName": "TestTable",
            "InstanceName": "mytest",
            "PrimaryKey": [
              {
                "Type": "INTEGER",
                "Name": "id"
              }
            ]
          }
        }
      }
    }