ALIYUN::OTS::Table

更新时间:
复制 MD 格式

The ALIYUN::OTS::Table resource creates a table based on the specified table 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

PropertyTypeRequiredUpdate allowedDescriptionConstraints
ReservedThroughputMapNoYesThe initial reserved read and write throughput of the table.The reserved read throughput and reserved write throughput for any table cannot exceed 5,000 reads/writes per second.

For more information, see the ReservedThroughput property.

MaxVersionsIntegerNoYesThe maximum number of versions to retain for the table.Valid values: 1 to 2,147,483,647.

Default value: 1.

TableNameStringYesNoThe name of the table.None
SecondaryIndicesListNoNoThe secondary indexes of the table.For more information, see the SecondaryIndices property.
DeviationCellVersionInSecIntegerNoYesThe maximum version drift.This property prevents writing data with a timestamp that deviates significantly from the expected time. For example, if the current UNIX timestamp is 10,000 and you set DeviationCellVersionInSec to 1,000, the allowed timestamp range for writes is 9,000 to 11,000.

Valid values: 1 to 9,223,372,036,854,775,807.

Default value: 86,400.

TimeToLiveIntegerNoYesThe retention period of data in the table.

Maximum value: 2,147,483,647.

Default value: 1.

Unit: seconds.

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

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

For more information, see the PrimaryKey property.

ColumnsListNoNoThe attribute columns stored in the table.For more information, see the Columns property.

ReservedThroughput syntax

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

ReservedThroughput properties

Property NameTypeRequiredUpdate allowedDescriptionConstraints
ReadIntegerYesYesThe capacity units for reads or the reserved read throughput of the table.Default value: 0.
WriteIntegerYesYesThe capacity units for writes or the reserved write throughput of the table.Default value: 0.

SecondaryIndices syntax

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

SecondaryIndices properties

Property NameTypeRequiredUpdate allowedDescriptionConstraints
IndexNameStringYesNoThe index name.None
IndexTypeStringNoNoThe index type.Valid values:
  • Global
  • Local
ColumnsListYesNoThe index columns.Example:
["name", "email"]
Note This property is different from the Columns property.
PrimaryKeysListYesNoThe primary keys.None

PrimaryKey syntax

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

PrimaryKey properties

PropertyTypeRequiredUpdate allowedDescriptionConstraints
TypeStringYesNoThe type of the primary key.Valid values:
  • INTEGER: Integer
  • STRING: String
  • BINARY: Binary
NameStringYesNoThe name of the primary key.None

Columns syntax

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

Columns properties

PropertyTypeRequiredUpdate allowedDescriptionConstraints
TypeStringYesNoThe type of the column.None
NameStringYesNoThe name of the column.None

Return value

Fn::GetAtt

TableName: The name of the table.

Examples

  • YAML format

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

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