

如需與 Amazon Timestream for LiveAnalytics 類似的功能，請考慮使用 Amazon Timestream for InfluxDB。它提供簡化的資料擷取和單一位數毫秒查詢回應時間，以進行即時分析。[在這裡](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>

如需所有動作的一般參數資訊，請參閱《[Common Parameters](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 **   
操作嘗試存取不存在的資源。資源可能未正確指定，或其狀態可能不是 ACTIVE。  
HTTP 狀態碼：400

 ** ServiceQuotaExceededException **   
 此帳戶超過資源的執行個體配額。  
HTTP 狀態碼：400

 ** ThrottlingException **   
 使用者提出的請求太多，而且超過服務配額。請求受到調節。  
HTTP 狀態碼：400

 ** ValidationException **   
 無效或格式不正確的請求。  
HTTP 狀態碼：400

## 另請參閱
<a name="API_CreateTable_SeeAlso"></a>

如需在其中一種語言特定 AWS SDKs中使用此 API 的詳細資訊，請參閱下列內容：
+  [AWS 命令列界面 V2](https://docs.aws.amazon.com/goto/cli2/timestream-write-2018-11-01/CreateTable) 
+  [AWS 適用於 .NET V4 的 SDK](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 的 SDK v2](https://docs.aws.amazon.com/goto/SdkForGoV2/timestream-write-2018-11-01/CreateTable) 
+  [AWS 適用於 Java V2 的 SDK](https://docs.aws.amazon.com/goto/SdkForJavaV2/timestream-write-2018-11-01/CreateTable) 
+  [AWS 適用於 JavaScript V3 的 SDK](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 V3 的 SDK](https://docs.aws.amazon.com/goto/SdkForPHPV3/timestream-write-2018-11-01/CreateTable) 
+  [AWS 適用於 Python 的 SDK](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) 