ALIYUN::OTS::Table类型用于根据指定的表结构信息创建相应的表。
语法
{
"Type": "ALIYUN::OTS::Table",
"Properties": {
"ReservedThroughput": Map,
"MaxVersions": Integer,
"TableName": String,
"SecondaryIndices": List,
"DeviationCellVersionInSec": Integer,
"TimeToLive": Integer,
"InstanceName": String,
"PrimaryKey": List,
"Columns": List
}
}属性
| 属性名称 | 类型 | 必须 | 允许更新 | 描述 | 约束 |
|---|---|---|---|---|---|
| ReservedThroughput | Map | 否 | 是 | 表的初始预留读或写吞吐量设定。 | 任何表的预留读吞吐量与预留写吞吐量均不能超过5000次/秒。 详情请参见ReservedThroughput属性。 |
| MaxVersions | Integer | 否 | 是 | 表保留的最大版本数。 | 取值范围:1~2,147,483,647。 默认值:1。 |
| TableName | String | 是 | 否 | 表的名称。 | 无 |
| SecondaryIndices | List | 否 | 否 | 表的二级指标。 | 详情请参见SecondaryIndices属性。 |
| DeviationCellVersionInSec | Integer | 否 | 是 | 最高版本偏差。 | 用于禁止写入与预期较大的数据。例如:当前时间戳为10000,如果将DeviationCellVersionInSec设置为1000,则允许写入的时间戳范围为:9000~11000。 取值范围:1~9,223,372,036,854,775807。 默认值:86,400。 |
| TimeToLive | Integer | 否 | 是 | 表中数据的保留时间。 | 最大值:2,147,483,647。 默认值:1。 单位:秒。 -1表示不会过期。 |
| InstanceName | String | 是 | 否 | 表所在的OTS实例的名称。 | 无 |
| PrimaryKey | List | 是 | 否 | 表全部的主键列。 | 取值范围:1~4。 更多信息,请参见PrimaryKey属性。 |
| Columns | List | 否 | 否 | 表存储的属性列。 | 更多信息,请参见Columns属性。 |
ReservedThroughput语法
"ReservedThroughput": {
"Read": Integer,
"Write": Integer
}ReservedThroughput属性
| 属性名称 | 类型 | 必须 | 允许更新 | 描述 | 约束 |
|---|---|---|---|---|---|
| Read | Integer | 是 | 是 | 使用的读服务能力单元或表的预留读吞吐量。 | 默认值:0。 |
| Write | Integer | 是 | 是 | 使用的写服务能力单元或表的预留写吞吐量。 | 默认值:0。 |
SecondaryIndices语法
"SecondaryIndices": [
{
"IndexName": String,
"IndexType": String,
"Columns": List,
"PrimaryKeys": List
}
]SecondaryIndices属性
| 属性名称 | 类型 | 必须 | 允许更新 | 描述 | 约束 |
|---|---|---|---|---|---|
| IndexName | String | 是 | 否 | 索引名称 | 无 |
| IndexType | String | 否 | 否 | 索引类型 | 取值:
|
| Columns | List | 是 | 否 | 索引列 | 示例值:说明 该属性不同于Columns属性。 |
| PrimaryKeys | List | 是 | 否 | 主键 | 无 |
PrimaryKey语法
"PrimaryKey": [
{
"Type": String,
"Name": String
}
]PrimaryKey属性
| 属性名称 | 类型 | 必须 | 允许更新 | 描述 | 约束 |
|---|---|---|---|---|---|
| Type | String | 是 | 否 | 主键的类型 | 取值:
|
| Name | String | 是 | 否 | 主键的名称 | 无 |
Columns语法
"Columns": [
{
"Type": String,
"Name": String
}
]Columns属性
| 属性名称 | 类型 | 必须 | 允许更新 | 描述 | 约束 |
|---|---|---|---|---|---|
| Type | String | 是 | 否 | 列的类型 | 无 |
| Name | String | 是 | 否 | 列的名字 | 无 |
返回值
Fn::GetAtt
TableName:表名。
示例
JSON格式{ "ROSTemplateFormatVersion": "2015-09-01", "Parameters": { }, "Resources": { "Table": { "Type": "ALIYUN::OTS::Table", "Properties": { "TableName": "TestTable", "InstanceName": "mytest", "PrimaryKey": [ { "Type": "INTEGER", "Name": "id" } ] } } } }