| Did this page help you? Yes No Tell us about it... |
The CreateTable operation adds a new table to your account. The table
name must be unique among those associated with the AWS Account issuing the request, and
the AWS region that receives the request (such as dynamodb.us-east-1.amazonaws.com).
Each Amazon DynamoDB endpoint is entirely independent. For example, if you have two tables
called "MyTable," one in dynamodb.us-east-1.amazonaws.com and one in
dynamodb.us-west-1.amazonaws.com, they are completely independent and do not share any
data.
The CreateTable operation triggers an asynchronous workflow to
begin creating the table. Amazon DynamoDB immediately returns the state of the table
(CREATING) until the table is in the
ACTIVE state. Once the table is in the
ACTIVE state, you can perform data plane operations.
Use the DescribeTable API to check the status of the table.
// This header is abbreviated. // For a sample of a complete header, see Sample Amazon DynamoDB JSON Request and Response. POST / HTTP/1.1 x-amz-target: DynamoDB_20111205.CreateTable content-type: application/x-amz-json-1.0 {"TableName":"Table1", "KeySchema": {"HashKeyElement":{"AttributeName":"AttributeName1","AttributeType":"S"}, "RangeKeyElement":{"AttributeName":"AttributeName2","AttributeType":"N"}}, "ProvisionedThroughput":{"ReadCapacityUnits":5,"WriteCapacityUnits":10} }
| Name | Description | Required | |||
|---|---|---|---|---|---|
TableName
|
The name of the table to create. Allowed characters are a-z, A-Z, 0-9, '_' (underscore), '-' (dash), and '.' (dot). Names can be between 3 and 255 characters long. Type: String | Yes | |||
KeySchema
| The primary key (simple or composite) structure for the table. A name-value
pair for the Primary key element names can be between 1 and 255 characters long with no character restrictions. Type: Map of
| Yes | |||
ProvisionedThroughput
| New throughput for the specified table, consisting of values for
ReadCapacityUnits and
WriteCapacityUnits. For details, see Specifying Read and Write Requirements (Provisioned
Throughput).
Type: Array | Yes | |||
ProvisionedThroughput:
ReadCapacityUnits |
Sets the minimum number of consistent Eventually consistent read operations require less effort than
a consistent read operation, so a setting of 50 consistent
Type: Number | Yes | |||
ProvisionedThroughput:
WriteCapacityUnits | Sets the minimum number of WriteCapacityUnits consumed per
second for the specified table before Amazon DynamoDB balances the load with
other operations. Type: Number | Yes |
HTTP/1.1 200 OK
x-amzn-RequestId: CSOC7TJPLR0OOKIRLGOHVAICUFVV4KQNSO5AEMVJF66Q9ASUAAJG
content-type: application/x-amz-json-1.0
content-length: 311
Date: Tue, 12 Jul 2011 21:31:03 GMT
{"TableDescription":
{"CreationDateTime":1.310506263362E9,
"KeySchema":
{"HashKeyElement":{"AttributeName":"AttributeName1","AttributeType":"S"},
"RangeKeyElement":{"AttributeName":"AttributeName2","AttributeType":"N"}},
"ProvisionedThroughput":{"ReadCapacityUnits":5,"WriteCapacityUnits":10},
"TableName":"Table1",
"TableStatus":"CREATING"
}
}| Name | Description |
|---|---|
TableDescription
| A container for the table properties. |
CreationDateTime | Date when the table was created in UNIX epoch time. Type: Number |
KeySchema
| The primary key (simple or composite) structure for the table. A name-value pair for
the Type: Map of
|
ProvisionedThroughput
|
Throughput for the specified table, consisting of values
for Type: Array |
ProvisionedThroughput
:ReadCapacityUnits |
The minimum number of
Type: Number |
ProvisionedThroughput
:WriteCapacityUnits |
The minimum number of
Type: Number |
TableName
|
The name of the deleted table. Type: String |
TableStatus
| The current state of the table ( Use the DescribeTable API to check the status of the table. Type: String |
| Error | Description | |||
|---|---|---|---|---|
ResourceInUse
| Attempt to recreate an already existing table. | |||
LimitExceeded
| The number of simultaneous table requests (cumulative number of tables in the
|
The following example creates a table with a composite primary key containing a string and a number. For examples using the AWS SDK, see Working with Tables in Amazon DynamoDB.
// This header is abbreviated. // For a sample of a complete header, see Sample Amazon DynamoDB JSON Request and Response. POST / HTTP/1.1 x-amz-target: DynamoDB_20111205.CreateTable content-type: application/x-amz-json-1.0 {"TableName":"comp-table", "KeySchema": {"HashKeyElement":{"AttributeName":"user","AttributeType":"S"}, "RangeKeyElement":{"AttributeName":"time","AttributeType":"N"}}, "ProvisionedThroughput":{"ReadCapacityUnits":5,"WriteCapacityUnits":10} }
HTTP/1.1 200 OK
x-amzn-RequestId: CSOC7TJPLR0OOKIRLGOHVAICUFVV4KQNSO5AEMVJF66Q9ASUAAJG
content-type: application/x-amz-json-1.0
content-length: 311
Date: Tue, 12 Jul 2011 21:31:03 GMT
{"TableDescription":
{"CreationDateTime":1.310506263362E9,
"KeySchema":
{"HashKeyElement":{"AttributeName":"user","AttributeType":"S"},
"RangeKeyElement":{"AttributeName":"time","AttributeType":"N"}},
"ProvisionedThroughput":{"ReadCapacityUnits":5,"WriteCapacityUnits":10},
"TableName":"comp-table",
"TableStatus":"CREATING"
}
}