Error: dynamodb global secondary index does not project

Answered by Rafal Wilinski
What's Causing This Error
This error message indicates an issue with how the global secondary index (GSI) is used in a DynamoDB table.
Specifically, it indicates that the GSI is not projecting the necessary attributes. This can happen if the GSI is not correctly configured if the GSI is not being updated with the required attributes.
Solution: Here's How To Resolve It
To solve this error, check the configuration of the GSI to ensure that it is correctly set up and projecting the necessary attributes.
Hence, when creating the GSI, specify the attributes you want to project using the Projection property.
import boto3
# Instantiate a client
dynamodb = boto3.client('dynamodb', region_name='us-west-2')
# Define the parameters
table_name = "my_table"
gsi_name = "my_gsi"
attributes_to_project = ["attribute1", "attribute2"]
gsi_params = {
'Attribute_definitions': [
{
'Attribute_name': 'attribute1',
'attribute_type': 'S'
},
{
'attribute_name': 'attribute2',
'attribute_type': 'S'
},
],
'key_schema': [
{
'attribute_name': 'attribute1',
'key_type': 'HASH'
},
{
'attribute_name': 'attribute2',
'key_type': 'RANGE'
}
],
'projection': {
'projection_type': 'INCLUDE',
'non_key_attributes': attributes_to_project
},
'provisioned_throughput': {
'read_capacity_units': 5,
'write_capacity_units': 5
}
}
# Create the GSI
dynamodb.create_table(TableName=table_name, GlobalSecondaryIndexes=[{'IndexName': gsi_name, **gsi_params}
Other Common DynamoDB Errors (with Solutions)
- DynamoDB stream no records processed
- moto dynamodb not working
- dynamodb-admin is not recognized as an internal or external command
- DynamoDB No Provisioned Throughput specified for the table
- dynamodb number_value cannot be converted to string
- dynamodb local unable to open database file
- dynamodb validation error detected
- dynamodb no range key value present
- DynamoDB No Regionendpoint Or Serviceurl Configured
- dynamodb condition does not exist
- can't pickle thread.lock objects typeerror boto3 python dynamodb
- dynamodb index does not exist
- ImportError: No module named boto3 (DynamoDB)
- Boto3 DynamoDB KeyError
- dynamodb scan missing values
Dynobase is a Professional GUI Client for DynamoDB
Start your 7-day free trial today
Product Features
DynamoDB Tools
DynamoDB Info
© 2026 Dynobase