UpdateTable
Modifies the provisioned throughput settings, global secondary indexes, or DynamoDB Streams settings for a given table.
Important
For global tables, this operation only applies to global tables using Version 2019.11.21 (Current version).
You can only perform one of the following operations at once:
-
Modify the provisioned throughput settings of the table.
-
Remove a global secondary index from the table.
-
Create a new global secondary index on the table. After the index begins backfilling, you can use
UpdateTable
to perform other operations.
UpdateTable
is an asynchronous operation; while it's executing, the table
status changes from ACTIVE
to UPDATING
. While it's
UPDATING
, you can't issue another UpdateTable
request.
When the table returns to the ACTIVE
state, the UpdateTable
operation is complete.
Request Syntax
{
"AttributeDefinitions": [
{
"AttributeName": "string
",
"AttributeType": "string
"
}
],
"BillingMode": "string
",
"DeletionProtectionEnabled": boolean
,
"GlobalSecondaryIndexUpdates": [
{
"Create": {
"IndexName": "string
",
"KeySchema": [
{
"AttributeName": "string
",
"KeyType": "string
"
}
],
"OnDemandThroughput": {
"MaxReadRequestUnits": number
,
"MaxWriteRequestUnits": number
},
"Projection": {
"NonKeyAttributes": [ "string
" ],
"ProjectionType": "string
"
},
"ProvisionedThroughput": {
"ReadCapacityUnits": number
,
"WriteCapacityUnits": number
},
"WarmThroughput": {
"ReadUnitsPerSecond": number
,
"WriteUnitsPerSecond": number
}
},
"Delete": {
"IndexName": "string
"
},
"Update": {
"IndexName": "string
",
"OnDemandThroughput": {
"MaxReadRequestUnits": number
,
"MaxWriteRequestUnits": number
},
"ProvisionedThroughput": {
"ReadCapacityUnits": number
,
"WriteCapacityUnits": number
},
"WarmThroughput": {
"ReadUnitsPerSecond": number
,
"WriteUnitsPerSecond": number
}
}
}
],
"OnDemandThroughput": {
"MaxReadRequestUnits": number
,
"MaxWriteRequestUnits": number
},
"ProvisionedThroughput": {
"ReadCapacityUnits": number
,
"WriteCapacityUnits": number
},
"ReplicaUpdates": [
{
"Create": {
"GlobalSecondaryIndexes": [
{
"IndexName": "string
",
"OnDemandThroughputOverride": {
"MaxReadRequestUnits": number
},
"ProvisionedThroughputOverride": {
"ReadCapacityUnits": number
}
}
],
"KMSMasterKeyId": "string
",
"OnDemandThroughputOverride": {
"MaxReadRequestUnits": number
},
"ProvisionedThroughputOverride": {
"ReadCapacityUnits": number
},
"RegionName": "string
",
"TableClassOverride": "string
"
},
"Delete": {
"RegionName": "string
"
},
"Update": {
"GlobalSecondaryIndexes": [
{
"IndexName": "string
",
"OnDemandThroughputOverride": {
"MaxReadRequestUnits": number
},
"ProvisionedThroughputOverride": {
"ReadCapacityUnits": number
}
}
],
"KMSMasterKeyId": "string
",
"OnDemandThroughputOverride": {
"MaxReadRequestUnits": number
},
"ProvisionedThroughputOverride": {
"ReadCapacityUnits": number
},
"RegionName": "string
",
"TableClassOverride": "string
"
}
}
],
"SSESpecification": {
"Enabled": boolean
,
"KMSMasterKeyId": "string
",
"SSEType": "string
"
},
"StreamSpecification": {
"StreamEnabled": boolean
,
"StreamViewType": "string
"
},
"TableClass": "string
",
"TableName": "string
",
"WarmThroughput": {
"ReadUnitsPerSecond": number
,
"WriteUnitsPerSecond": number
}
}
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. You can also provide the Amazon Resource Name (ARN) of the table in this parameter.
Type: String
Length Constraints: Minimum length of 1. Maximum length of 1024.
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
- BillingMode
-
Controls how you are charged for read and write throughput and how you manage capacity. When switching from pay-per-request to provisioned capacity, initial provisioned capacity values must be set. The initial provisioned capacity values are estimated based on the consumed read and write capacity of your table and global secondary indexes over the past 30 minutes.
-
PROVISIONED
- We recommend usingPROVISIONED
for predictable workloads.PROVISIONED
sets the billing mode to Provisioned capacity mode. -
PAY_PER_REQUEST
- We recommend usingPAY_PER_REQUEST
for unpredictable workloads.PAY_PER_REQUEST
sets the billing mode to On-demand capacity mode.
Type: String
Valid Values:
PROVISIONED | PAY_PER_REQUEST
Required: No
-
- DeletionProtectionEnabled
-
Indicates whether deletion protection is to be enabled (true) or disabled (false) on the table.
Type: Boolean
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.
You can create or delete only one global secondary index per
UpdateTable
operation.For more information, see Managing Global Secondary Indexes in the Amazon DynamoDB Developer Guide.
Type: Array of GlobalSecondaryIndexUpdate objects
Required: No
-
- OnDemandThroughput
-
Updates the maximum number of read and write units for the specified table in on-demand capacity mode. If you use this parameter, you must specify
MaxReadRequestUnits
,MaxWriteRequestUnits
, or both.Type: OnDemandThroughput object
Required: No
- ProvisionedThroughput
-
The new provisioned throughput settings for the specified table or index.
Type: ProvisionedThroughput object
Required: No
- ReplicaUpdates
-
A list of replica update actions (create, delete, or update) for the table.
Note
For global tables, this property only applies to global tables using Version 2019.11.21 (Current version).
Type: Array of ReplicationGroupUpdate objects
Array Members: Minimum number of 1 item.
Required: No
- SSESpecification
-
The new server-side encryption settings for the specified table.
Type: SSESpecification object
Required: No
- StreamSpecification
-
Represents the DynamoDB Streams configuration for the table.
Note
You receive a
ValidationException
if you try to enable a stream on a table that already has a stream, or if you try to disable a stream on a table that doesn't have a stream.Type: StreamSpecification object
Required: No
- TableClass
-
The table class of the table to be updated. Valid values are
STANDARD
andSTANDARD_INFREQUENT_ACCESS
.Type: String
Valid Values:
STANDARD | STANDARD_INFREQUENT_ACCESS
Required: No
- WarmThroughput
-
Represents the warm throughput (in read units per second and write units per second) for updating a table.
Type: WarmThroughput object
Required: No
Response Syntax
{
"TableDescription": {
"ArchivalSummary": {
"ArchivalBackupArn": "string",
"ArchivalDateTime": number,
"ArchivalReason": "string"
},
"AttributeDefinitions": [
{
"AttributeName": "string",
"AttributeType": "string"
}
],
"BillingModeSummary": {
"BillingMode": "string",
"LastUpdateToPayPerRequestDateTime": number
},
"CreationDateTime": number,
"DeletionProtectionEnabled": boolean,
"GlobalSecondaryIndexes": [
{
"Backfilling": boolean,
"IndexArn": "string",
"IndexName": "string",
"IndexSizeBytes": number,
"IndexStatus": "string",
"ItemCount": number,
"KeySchema": [
{
"AttributeName": "string",
"KeyType": "string"
}
],
"OnDemandThroughput": {
"MaxReadRequestUnits": number,
"MaxWriteRequestUnits": number
},
"Projection": {
"NonKeyAttributes": [ "string" ],
"ProjectionType": "string"
},
"ProvisionedThroughput": {
"LastDecreaseDateTime": number,
"LastIncreaseDateTime": number,
"NumberOfDecreasesToday": number,
"ReadCapacityUnits": number,
"WriteCapacityUnits": number
},
"WarmThroughput": {
"ReadUnitsPerSecond": number,
"Status": "string",
"WriteUnitsPerSecond": number
}
}
],
"GlobalTableVersion": "string",
"ItemCount": number,
"KeySchema": [
{
"AttributeName": "string",
"KeyType": "string"
}
],
"LatestStreamArn": "string",
"LatestStreamLabel": "string",
"LocalSecondaryIndexes": [
{
"IndexArn": "string",
"IndexName": "string",
"IndexSizeBytes": number,
"ItemCount": number,
"KeySchema": [
{
"AttributeName": "string",
"KeyType": "string"
}
],
"Projection": {
"NonKeyAttributes": [ "string" ],
"ProjectionType": "string"
}
}
],
"OnDemandThroughput": {
"MaxReadRequestUnits": number,
"MaxWriteRequestUnits": number
},
"ProvisionedThroughput": {
"LastDecreaseDateTime": number,
"LastIncreaseDateTime": number,
"NumberOfDecreasesToday": number,
"ReadCapacityUnits": number,
"WriteCapacityUnits": number
},
"Replicas": [
{
"GlobalSecondaryIndexes": [
{
"IndexName": "string",
"OnDemandThroughputOverride": {
"MaxReadRequestUnits": number
},
"ProvisionedThroughputOverride": {
"ReadCapacityUnits": number
},
"WarmThroughput": {
"ReadUnitsPerSecond": number,
"Status": "string",
"WriteUnitsPerSecond": number
}
}
],
"KMSMasterKeyId": "string",
"OnDemandThroughputOverride": {
"MaxReadRequestUnits": number
},
"ProvisionedThroughputOverride": {
"ReadCapacityUnits": number
},
"RegionName": "string",
"ReplicaInaccessibleDateTime": number,
"ReplicaStatus": "string",
"ReplicaStatusDescription": "string",
"ReplicaStatusPercentProgress": "string",
"ReplicaTableClassSummary": {
"LastUpdateDateTime": number,
"TableClass": "string"
},
"WarmThroughput": {
"ReadUnitsPerSecond": number,
"Status": "string",
"WriteUnitsPerSecond": number
}
}
],
"RestoreSummary": {
"RestoreDateTime": number,
"RestoreInProgress": boolean,
"SourceBackupArn": "string",
"SourceTableArn": "string"
},
"SSEDescription": {
"InaccessibleEncryptionDateTime": number,
"KMSMasterKeyArn": "string",
"SSEType": "string",
"Status": "string"
},
"StreamSpecification": {
"StreamEnabled": boolean,
"StreamViewType": "string"
},
"TableArn": "string",
"TableClassSummary": {
"LastUpdateDateTime": number,
"TableClass": "string"
},
"TableId": "string",
"TableName": "string",
"TableSizeBytes": number,
"TableStatus": "string",
"WarmThroughput": {
"ReadUnitsPerSecond": number,
"Status": "string",
"WriteUnitsPerSecond": number
}
}
}
Response Elements
If the action is successful, the service sends back an HTTP 200 response.
The following data is returned in JSON format by the service.
- TableDescription
-
Represents the properties of the 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
-
There is no limit to the number of daily on-demand backups that can be taken.
For most purposes, up to 500 simultaneous table operations are allowed per account. These operations include
CreateTable
,UpdateTable
,DeleteTable
,UpdateTimeToLive
,RestoreTableFromBackup
, andRestoreTableToPointInTime
.When you are creating a table with one or more secondary indexes, you can have up to 250 such requests running at a time. However, if the table or index specifications are complex, then DynamoDB might temporarily reduce the number of concurrent operations.
When importing into DynamoDB, up to 50 simultaneous import table operations are allowed per account.
There is a soft account quota of 2,500 tables.
GetRecords was called with a value of more than 1000 for the limit request parameter.
More than 2 processes are reading from the same streams shard at the same time. Exceeding this limit may result in request throttling.
HTTP Status Code: 400
- ResourceInUseException
-
The operation conflicts with the resource's availability. For example:
-
You attempted to recreate an existing table.
-
You tried to delete a table currently in the
CREATING
state. -
You tried to update a resource that was already being updated.
When appropriate, wait for the ongoing update to complete and attempt the request again.
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>;
Accept-Encoding: identity
Content-Length: <PayloadSizeBytes>
User-Agent: <UserAgentString>
Content-Type: application/x-amz-json-1.0
Authorization: AWS4-HMAC-SHA256 Credential=<Credential>, SignedHeaders=<Headers>, Signature=<Signature>
X-Amz-Date: <Date>
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": {
"TableArn": "arn:aws:dynamodb:us-west-2:123456789012:table/Thread",
"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"
}
}
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following: