Amazon DynamoDB
API Reference (API Version 2012-08-10)
Did this page help you?  Yes | No |  Tell us about it...
« PreviousNext »
View the PDF for this guide.Go to the AWS Discussion Forum for this product.

UpdateTable

Updates the provisioned throughput for the given table, or manages the global secondary indexes on the table.

You can increase or decrease the table's provisioned throughput values within the maximums and minimums listed in the Limits section in the Amazon DynamoDB Developer Guide.

In addition, you can use UpdateTable to add, modify or delete global secondary indexes on the table. For more information, see Managing Global Secondary Indexes in the Amazon DynamoDB Developer Guide.

The table must be in the ACTIVE state for UpdateTable to succeed. UpdateTable is an asynchronous operation; while executing the operation, the table is in the UPDATING state. While the table is in the UPDATING state, the table still has the provisioned throughput from before the call. The table's new provisioned throughput settings go into effect when the table returns to the ACTIVE state; at that point, the UpdateTable operation is complete.

Request Syntax

{
    "AttributeDefinitions": [
        {
            "AttributeName": "string",
            "AttributeType": "string"
        }
    ],
    "GlobalSecondaryIndexUpdates": [
        {
            "Create": {
                "IndexName": "string",
                "KeySchema": [
                    {
                        "AttributeName": "string",
                        "KeyType": "string"
                    }
                ],
                "Projection": {
                    "NonKeyAttributes": [
                        "string"
                    ],
                    "ProjectionType": "string"
                },
                "ProvisionedThroughput": {
                    "ReadCapacityUnits": "number",
                    "WriteCapacityUnits": "number"
                }
            },
            "Delete": {
                "IndexName": "string"
            },
            "Update": {
                "IndexName": "string",
                "ProvisionedThroughput": {
                    "ReadCapacityUnits": "number",
                    "WriteCapacityUnits": "number"
                }
            }
        }
    ],
    "ProvisionedThroughput": {
        "ReadCapacityUnits": "number",
        "WriteCapacityUnits": "number"
    },
    "TableName": "string"
}
			

Request Parameters

The request accepts the following data in JSON format.

Note

In the following list, the required parameters are described first.

TableName

The name of the table to be updated.

Type: String

Length constraints: Minimum length of 3. Maximum length of 255.

Required: Yes

AttributeDefinitions

An array of attributes that describe the key schema for the table and indexes. If you are adding a new global secondary index to the table, AttributeDefinitions must include the key element(s) of the new index.

Type: array of AttributeDefinition objects

Required: No

GlobalSecondaryIndexUpdates

An array of one or more global secondary indexes for the table. For each index in the array, you can request one action:

  • Create - add a new global secondary index to the table.

  • Update - modify the provisioned throughput settings of an existing global secondary index.

  • Delete - remove a global secondary index from the table.

Type: array of GlobalSecondaryIndexUpdate objects

Required: No

ProvisionedThroughput

Represents the provisioned throughput settings for a specified table or index. The settings can be modified using the UpdateTable operation.

For current minimum and maximum provisioned throughput values, see Limits in the Amazon DynamoDB Developer Guide.

Type: ProvisionedThroughput object

Required: No

Response Syntax

{
    "TableDescription": {
        "AttributeDefinitions": [
            {
                "AttributeName": "string",
                "AttributeType": "string"
            }
        ],
        "CreationDateTime": "number",
        "GlobalSecondaryIndexes": [
            {
                "Backfilling": "boolean",
                "IndexName": "string",
                "IndexSizeBytes": "number",
                "IndexStatus": "string",
                "ItemCount": "number",
                "KeySchema": [
                    {
                        "AttributeName": "string",
                        "KeyType": "string"
                    }
                ],
                "Projection": {
                    "NonKeyAttributes": [
                        "string"
                    ],
                    "ProjectionType": "string"
                },
                "ProvisionedThroughput": {
                    "LastDecreaseDateTime": "number",
                    "LastIncreaseDateTime": "number",
                    "NumberOfDecreasesToday": "number",
                    "ReadCapacityUnits": "number",
                    "WriteCapacityUnits": "number"
                }
            }
        ],
        "ItemCount": "number",
        "KeySchema": [
            {
                "AttributeName": "string",
                "KeyType": "string"
            }
        ],
        "LocalSecondaryIndexes": [
            {
                "IndexName": "string",
                "IndexSizeBytes": "number",
                "ItemCount": "number",
                "KeySchema": [
                    {
                        "AttributeName": "string",
                        "KeyType": "string"
                    }
                ],
                "Projection": {
                    "NonKeyAttributes": [
                        "string"
                    ],
                    "ProjectionType": "string"
                }
            }
        ],
        "ProvisionedThroughput": {
            "LastDecreaseDateTime": "number",
            "LastIncreaseDateTime": "number",
            "NumberOfDecreasesToday": "number",
            "ReadCapacityUnits": "number",
            "WriteCapacityUnits": "number"
        },
        "TableName": "string",
        "TableSizeBytes": "number",
        "TableStatus": "string"
    }
}
			

Response Elements

The following data is returned in JSON format by the service.

TableDescription

Represents the properties of a table.

Type: TableDescription object

Errors

For information about the errors that are common to all actions, see Common Errors.

InternalServerError

An error occurred on the server side.

HTTP Status Code: 500

LimitExceededException

The number of concurrent table requests (cumulative number of tables in the CREATING, DELETING or UPDATING state) exceeds the maximum allowed of 10.

Also, for tables with secondary indexes, only one of those tables can be in the CREATING state at any point in time. Do not attempt to create more than one such table simultaneously.

The total limit of tables in the ACTIVE state is 250.

HTTP Status Code: 400

ResourceInUseException

The operation conflicts with the resource's availability. For example, you attempted to recreate an existing table, or tried to delete a table currently in the CREATING state.

HTTP Status Code: 400

ResourceNotFoundException

The operation tried to access a nonexistent table or index. The resource might not be specified correctly, or its status might not be ACTIVE.

HTTP Status Code: 400

Examples

Modify Provisioned Write Throughput

This example changes both the provisioned read and write throughput of the Thread table to 10 capacity units.

Sample Request

POST / HTTP/1.1
Host: dynamodb.<region>.<domain>;
X-Amz-Date: <Date>
Authorization: AWS4-HMAC-SHA256 Credential=<Credential>, SignedHeaders=content-length;content-type;host;user-agent;x-amz-content-sha256;x-amz-date;x-amz-target, Signature=<Signature>
User-Agent: <UserAgentString>
x-amz-content-sha256: <PayloadHash>
Content-Type: application/x-amz-json-1.0
Content-Length: <PayloadSizeBytes>     
Connection: Keep-Alive X-Amz-Target: DynamoDB_20120810.UpdateTable 

{
    "TableName": "Thread",
    "ProvisionedThroughput": {
        "ReadCapacityUnits": 10,
        "WriteCapacityUnits": 10
    }
}
        

Sample Response

HTTP/1.1 200 OK
x-amzn-RequestId: <RequestId> 
x-amz-crc32: <Checksum>
Content-Type: application/x-amz-json-1.0
Content-Length: <PayloadSizeBytes>
Date: <Date>
 {          
    "TableDescription": {
        "AttributeDefinitions": [
            {
                "AttributeName": "ForumName",
                "AttributeType": "S"
            },
            {
                "AttributeName": "LastPostDateTime",
                "AttributeType": "S"
            },
            {
                "AttributeName": "Subject",
                "AttributeType": "S"
            }
        ],
        "CreationDateTime": 1.363801528686E9,
        "ItemCount": 0,
        "KeySchema": [
            {
                "AttributeName": "ForumName",
                "KeyType": "HASH"
            },
            {
                "AttributeName": "Subject",
                "KeyType": "RANGE"
            }
        ],
        "LocalSecondaryIndexes": [
            {
                "IndexName": "LastPostIndex",
                "IndexSizeBytes": 0,
                "ItemCount": 0,
                "KeySchema": [
                    {
                        "AttributeName": "ForumName",
                        "KeyType": "HASH"
                    },
                    {
                        "AttributeName": "LastPostDateTime",
                        "KeyType": "RANGE"
                    }
                ],
                "Projection": {
                    "ProjectionType": "KEYS_ONLY"
                }
            }
        ],
        "ProvisionedThroughput": {
            "LastIncreaseDateTime": 1.363801701282E9,
            "NumberOfDecreasesToday": 0,
            "ReadCapacityUnits": 5,
            "WriteCapacityUnits": 5
        },
        "TableName": "Thread",
        "TableSizeBytes": 0,
        "TableStatus": "UPDATING"
    }
}