UpdateTable method
Written by
Updated at March 18, 2024
Updates global secondary indexes and streaming settings for a specific table.
You can perform only one of the following operations per query:
- Add a global secondary index to the table.
- Delete a global secondary index from the table.
- Enable/disable update streaming.
Request
The request contains data in JSON format.
{
"AttributeDefinitions": [
{
"AttributeName": "string",
"AttributeType": "string"
}
],
"BillingMode": "string",
"GlobalSecondaryIndexUpdates": [
{
"Create": {
"IndexName": "string",
"KeySchema": [
{
"AttributeName": "string",
"KeyType": "string"
}
],
"Projection": {
"NonKeyAttributes": [ "string" ],
"ProjectionType": "string"
}
},
"Delete": {
"IndexName": "string"
}
}
],
"StreamSpecification": {
"StreamEnabled": boolean,
"StreamViewType": "string"
},
"TableName": "string"
}
Parameters
Parameter | Description |
---|---|
TableName |
Name of the table to update. May contain a path in the hierarchical directory structure in path/to/table format. Type: String Length: 3-255 characters Template: [a-zA-Z0-9_.-]+ Required: Yes |
AttributeDefinitions |
Array of attributes describing the key schema for the table and indexes. Type: Array of AttributeDefinition type objectsRequired: No |
GlobalSecondaryIndexUpdates |
Array of operations describing actions on global secondary indexes:
When creating an index, specify the following parameters:
Required: No When deleting a table, it is enough to specify IndexName . |
StreamSpecification |
Description of the update stream settings for a table:
Type: StreamSpecification type objectRequired: No |
Response
If successful, HTTP code 200 is returned.
The response is returned in JSON format.
{
"TableDescription": {
"ArchivalSummary": {
"ArchivalBackupArn": "string",
"ArchivalDateTime": number,
"ArchivalReason": "string"
},
"AttributeDefinitions": [
{
"AttributeName": "string",
"AttributeType": "string"
}
],
"BillingModeSummary": {
"BillingMode": "string",
"LastUpdateToPayPerRequestDateTime": number
},
"CreationDateTime": number,
"GlobalTableVersion": "string",
"ItemCount": number,
"KeySchema": [
{
"AttributeName": "string",
"KeyType": "string"
}
],
"LatestStreamArn": "string",
"LatestStreamLabel": "string",
"Replicas": [
{
"KMSMainKeyId": "string",
"RegionName": "string",
"ReplicaStatus": "string",
"ReplicaStatusDescription": "string",
"ReplicaStatusPercentProgress": "string"
}
],
"RestoreSummary": {
"RestoreDateTime": number,
"RestoreInProgress": boolean,
"SourceBackupArn": "string",
"SourceTableArn": "string"
},
"SSEDescription": {
"InaccessibleEncryptionDateTime": number,
"KMSMainKeyArn": "string",
"SSEType": "string",
"Status": "string"
},
"StreamSpecification": {
"StreamEnabled": boolean,
"StreamViewType": "string"
},
"TableArn": "string",
"TableId": "string",
"TableName": "string",
"TableSizeBytes": number,
"TableStatus": "string"
}
}
Parameters
Parameter | Description |
---|---|
TableDescription |
Properties of the created table. Type: TableDescription type object |
Errors
Parameter | Description |
---|---|
InternalServerError |
An internal error occurred on the server side. HTTP status code: 500 |
LimitExceededException |
Table operations limit exceeded. You can simultaneously perform up to 50 operations on tables, including CreateTable , UpdateTable , DeleteTable , UpdateTimeToLive , RestoreTableFromBackup , and RestoreTableToPointInTime .HTTP status code: 400 |
ResourceInUseException |
An attempt to create a table with a name that already exists. HTTP status code: 400 |
ResourceNotFoundException |
The specified table does not exist or is still being created using the createTable method HTTP status code: 400 |
ValidationException |
Attempt to enable update streaming if already enabled. Attempt to disable update streaming if it is disabled. Attempt to add an index with a name already taken. |
There may be some common errors as well that are the same for all methods.