

要获得与亚马逊 Timestream 类似的功能 LiveAnalytics，可以考虑适用于 InfluxDB 的亚马逊 Timestream。适用于 InfluxDB 的 Amazon Timestream 提供简化的数据摄取和个位数毫秒级的查询响应时间，以实现实时分析。点击[此处](https://docs.aws.amazon.com//timestream/latest/developerguide/timestream-for-influxdb.html)了解更多信息。

本文属于机器翻译版本。若本译文内容与英语原文存在差异，则一律以英文原文为准。

# CreateTable
<a name="API_CreateTable"></a>

将新表添加到账户中的现有数据库。在中 AWS 账户，如果表名位于同一个数据库中，则每个区域内的表名必须至少是唯一的。如果表位于单独的数据库中，则在同一区域中可能具有相同的表名称。创建表时，必须指定表名称、数据库名称和保留属性。[适用服务配额](https://docs.aws.amazon.com/timestream/latest/developerguide/ts-limits.html)。请参阅[代码示例](https://docs.aws.amazon.com/timestream/latest/developerguide/code-samples.create-table.html)，了解详细信息。

## 请求语法
<a name="API_CreateTable_RequestSyntax"></a>

```
{
   "DatabaseName": "string",
   "MagneticStoreWriteProperties": { 
      "EnableMagneticStoreWrites": boolean,
      "MagneticStoreRejectedDataLocation": { 
         "S3Configuration": { 
            "BucketName": "string",
            "EncryptionOption": "string",
            "KmsKeyId": "string",
            "ObjectKeyPrefix": "string"
         }
      }
   },
   "RetentionProperties": { 
      "MagneticStoreRetentionPeriodInDays": number,
      "MemoryStoreRetentionPeriodInHours": number
   },
   "Schema": { 
      "CompositePartitionKey": [ 
         { 
            "EnforcementInRecord": "string",
            "Name": "string",
            "Type": "string"
         }
      ]
   },
   "TableName": "string",
   "Tags": [ 
      { 
         "Key": "string",
         "Value": "string"
      }
   ]
}
```

## 请求参数
<a name="API_CreateTable_RequestParameters"></a>

有关所有操作的通用参数的信息，请参阅[常用参数](CommonParameters.md)。

请求接受采用 JSON 格式的以下数据。

 ** [DatabaseName](#API_CreateTable_RequestSyntax) **   <a name="timestream-CreateTable-request-DatabaseName"></a>
Timestream 数据库的名称。  
类型：字符串  
长度限制：最小长度为 3。最大长度为 256。  
模式：`[a-zA-Z0-9_.-]+`  
是否必需：是

 ** [MagneticStoreWriteProperties](#API_CreateTable_RequestSyntax) **   <a name="timestream-CreateTable-request-MagneticStoreWriteProperties"></a>
包含启用磁介质存储写入时要在表上设置的属性。  
类型：[MagneticStoreWriteProperties](API_MagneticStoreWriteProperties.md) 对象  
必需：否

 ** [RetentionProperties](#API_CreateTable_RequestSyntax) **   <a name="timestream-CreateTable-request-RetentionProperties"></a>
时间序列数据必须存储在内存存储和磁性存储中的持续时间。  
类型：[RetentionProperties](API_RetentionProperties.md) 对象  
必需：否

 ** [Schema](#API_CreateTable_RequestSyntax) **   <a name="timestream-CreateTable-request-Schema"></a>
 表的架构。  
类型：[Schema](API_Schema.md) 对象  
必需：否

 ** [TableName](#API_CreateTable_RequestSyntax) **   <a name="timestream-CreateTable-request-TableName"></a>
Timestream 表的名称。  
类型：字符串  
长度限制：最小长度为 3。最大长度为 256。  
模式：`[a-zA-Z0-9_.-]+`  
是否必需：是

 ** [Tags](#API_CreateTable_RequestSyntax) **   <a name="timestream-CreateTable-request-Tags"></a>
 用于标记表的键值对列表。  
类型：[Tag](API_Tag.md) 对象数组  
数组成员：最少 0 个物品。最多 200 项。  
必需：否

## 响应语法
<a name="API_CreateTable_ResponseSyntax"></a>

```
{
   "Table": { 
      "Arn": "string",
      "CreationTime": number,
      "DatabaseName": "string",
      "LastUpdatedTime": number,
      "MagneticStoreWriteProperties": { 
         "EnableMagneticStoreWrites": boolean,
         "MagneticStoreRejectedDataLocation": { 
            "S3Configuration": { 
               "BucketName": "string",
               "EncryptionOption": "string",
               "KmsKeyId": "string",
               "ObjectKeyPrefix": "string"
            }
         }
      },
      "RetentionProperties": { 
         "MagneticStoreRetentionPeriodInDays": number,
         "MemoryStoreRetentionPeriodInHours": number
      },
      "Schema": { 
         "CompositePartitionKey": [ 
            { 
               "EnforcementInRecord": "string",
               "Name": "string",
               "Type": "string"
            }
         ]
      },
      "TableName": "string",
      "TableStatus": "string"
   }
}
```

## 响应元素
<a name="API_CreateTable_ResponseElements"></a>

如果此操作成功，则该服务将会发送回 HTTP 200 响应。

服务以 JSON 格式返回以下数据。

 ** [Table](#API_CreateTable_ResponseSyntax) **   <a name="timestream-CreateTable-response-Table"></a>
新创建的 Timestream 表。  
类型：[Table](API_Table.md) 对象

## 错误
<a name="API_CreateTable_Errors"></a>

有关所有操作的常见错误的信息，请参阅[常见错误类型](CommonErrors.md)。

 ** AccessDeniedException **   
您无权执行此操作。  
HTTP 状态代码：400

 ** ConflictException **   
Timestream 无法处理此请求，因为其中包含已存在的资源。  
HTTP 状态代码：400

 ** InternalServerException **   
 由于内部服务器错误，Timestream 无法完全处理此请求。  
HTTP 状态代码：500

 ** InvalidEndpointException **   
请求的端点无效。  
HTTP 状态代码：400

 ** InvalidEndpointException **   
请求的端点无效。  
HTTP 状态代码：400

 ** ResourceNotFoundException **   
该操作试图访问不存在的资源。该资源可能未正确指定，或其状态可能不是“活动”状态。  
HTTP 状态代码：400

 ** ServiceQuotaExceededException **   
 已超出此账户的资源实例配额。  
HTTP 状态代码：400

 ** ThrottlingException **   
 用户发出的请求过多，已超出服务配额。请求已被阻止。  
HTTP 状态代码：400

 ** ValidationException **   
 请求无效或格式错误。  
HTTP 状态代码：400

## 另请参阅
<a name="API_CreateTable_SeeAlso"></a>

有关以特定语言之一使用此 API 的更多信息 AWS SDKs，请参阅以下内容：
+  [AWS 命令行界面 V2](https://docs.aws.amazon.com/goto/cli2/timestream-write-2018-11-01/CreateTable) 
+  [AWS 适用于.NET 的 SDK V4](https://docs.aws.amazon.com/goto/DotNetSDKV4/timestream-write-2018-11-01/CreateTable) 
+  [AWS 适用于 C\$1\$1 的 SDK](https://docs.aws.amazon.com/goto/SdkForCpp/timestream-write-2018-11-01/CreateTable) 
+  [AWS 适用于 Go v2 的 SDK](https://docs.aws.amazon.com/goto/SdkForGoV2/timestream-write-2018-11-01/CreateTable) 
+  [AWS 适用于 Java 的 SDK V2](https://docs.aws.amazon.com/goto/SdkForJavaV2/timestream-write-2018-11-01/CreateTable) 
+  [AWS JavaScript V3 版软件开发工具包](https://docs.aws.amazon.com/goto/SdkForJavaScriptV3/timestream-write-2018-11-01/CreateTable) 
+  [AWS 适用于 Kotlin 的 SDK](https://docs.aws.amazon.com/goto/SdkForKotlin/timestream-write-2018-11-01/CreateTable) 
+  [AWS 适用于 PHP 的 SDK V3](https://docs.aws.amazon.com/goto/SdkForPHPV3/timestream-write-2018-11-01/CreateTable) 
+  [AWS Python 软件开发工具包](https://docs.aws.amazon.com/goto/boto3/timestream-write-2018-11-01/CreateTable) 
+  [AWS 适用于 Ruby V3 的 SDK](https://docs.aws.amazon.com/goto/SdkForRubyV3/timestream-write-2018-11-01/CreateTable) 