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
| Property | Type | Required | Editable | Description | Constraint |
|---|---|---|---|---|---|
| ReservedThroughput | Map | No | Yes | The 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. |
| MaxVersions | Integer | No | Yes | The maximum number of data versions that can be retained in the table. | Valid values: 1 to 2147483647. Default value: 1. |
| TableName | String | Yes | No | The name of the table. | None |
| SecondaryIndices | List | No | No | The list of one or more secondary indices of the table. | For more information, see SecondaryIndices properties. |
| DeviationCellVersionInSec | Integer | No | Yes | The 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. |
| TimeToLive | Integer | No | Yes | The 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. |
| InstanceName | String | Yes | No | The name of the instance where the table resides. | None |
| PrimaryKey | List | Yes | No | All primary key columns of the table. | Valid values: 1 to 4. For more information, see PrimaryKey properties. |
| Columns | List | No | No | The 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
| Property | Type | Required | Editable | Description | Constraint |
|---|---|---|---|---|---|
| Read | Integer | Yes | Yes | The number of consumed read CUs or the reserved read throughput of the table. | Default value: 0. |
| Write | Integer | Yes | Yes | The 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
| Property | Type | Required | Editable | Description | Constraint |
|---|---|---|---|---|---|
| IndexName | String | Yes | No | The name of the index. | None |
| IndexType | String | No | No | The type of the index. | Valid values:
|
| Columns | List | Yes | No | The list of one or more columns of the index. | Example:Note The property of this parameter is different from Columns properties, which indicates the list of one or more attribute columns of the table. |
| PrimaryKeys | List | Yes | No | The list of one or more primary keys of the index. | None |
PrimaryKey syntax
"PrimaryKey": [
{
"Type": String,
"Name": String
}
]PrimaryKey properties
| Property | Type | Required | Editable | Description | Constraint |
|---|---|---|---|---|---|
| Type | String | Yes | No | The type of the primary key. | Valid values:
|
| Name | String | Yes | No | The name of the primary key. | None |
Columns syntax
"Columns": [
{
"Type": String,
"Name": String
}
]Columns properties
| Property | Type | Required | Editable | Description | Constraint |
|---|---|---|---|---|---|
| Type | String | Yes | No | The type of the column. | None |
| Name | String | Yes | No | The name of the column. | None |
Response parameters
Fn::GetAtt
TableName: the name of the table.
Examples
JSONformat{ "ROSTemplateFormatVersion": "2015-09-01", "Parameters": { }, "Resources": { "Table": { "Type": "ALIYUN::OTS::Table", "Properties": { "TableName": "TestTable", "InstanceName": "mytest", "PrimaryKey": [ { "Type": "INTEGER", "Name": "id" } ] } } } }