create_gsi
Add a global secondary index to a DynamoDB table by specifying the index name, partition key, projection type, and read/write capacities for optimized query performance.
Instructions
Creates a global secondary index on a table
Input Schema
Name | Required | Description | Default |
---|---|---|---|
indexName | Yes | Name of the new index | |
nonKeyAttributes | No | Non-key attributes to project (optional) | |
partitionKey | Yes | Partition key for the index | |
partitionKeyType | Yes | Type of partition key | |
projectionType | Yes | Type of projection | |
readCapacity | Yes | Provisioned read capacity units | |
sortKey | No | Sort key for the index (optional) | |
sortKeyType | No | Type of sort key (optional) | |
tableName | Yes | Name of the table | |
writeCapacity | Yes | Provisioned write capacity units |
Input Schema (JSON Schema)
{
"properties": {
"indexName": {
"description": "Name of the new index",
"type": "string"
},
"nonKeyAttributes": {
"description": "Non-key attributes to project (optional)",
"items": {
"type": "string"
},
"type": "array"
},
"partitionKey": {
"description": "Partition key for the index",
"type": "string"
},
"partitionKeyType": {
"description": "Type of partition key",
"enum": [
"S",
"N",
"B"
],
"type": "string"
},
"projectionType": {
"description": "Type of projection",
"enum": [
"ALL",
"KEYS_ONLY",
"INCLUDE"
],
"type": "string"
},
"readCapacity": {
"description": "Provisioned read capacity units",
"type": "number"
},
"sortKey": {
"description": "Sort key for the index (optional)",
"type": "string"
},
"sortKeyType": {
"description": "Type of sort key (optional)",
"enum": [
"S",
"N",
"B"
],
"type": "string"
},
"tableName": {
"description": "Name of the table",
"type": "string"
},
"writeCapacity": {
"description": "Provisioned write capacity units",
"type": "number"
}
},
"required": [
"tableName",
"indexName",
"partitionKey",
"partitionKeyType",
"projectionType",
"readCapacity",
"writeCapacity"
],
"type": "object"
}