I'm trying to create a GSI on a table with 30 columns (using ruby SDK). I use the projection_type: 'ALL' - but I still get the following exception:
Aws::DynamoDB::Errors::ValidationException: One or more parameter values were invalid: Number of projected attributes in all indexes exceeds limit of 20, number of projected attributes:30
As far as I read, this should only happen when using the INCLUDE
projection_type:
This limit does not apply for secondary indexes with a ProjectionType of KEYS_ONLY or ALL. http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Limits.html#limits-secondary-indexes
The create statement looks something like:
connection.update_table({
table_name: "my-table", # required
attribute_definitions: [
{
attribute_name: "indexDate",
attribute_type: "S",
},
{
attribute_name: "createdAt",
attribute_type: "S",
},
],
global_secondary_index_updates: [
{
create: {
index_name: "my-new-index", # required
key_schema: [
{
attribute_name: "indexDate",
key_type: "HASH",
},
{
attribute_name: "createdAt",
key_type: "RANGE",
},
],
projection: { # required
projection_type: "ALL"
},
provisioned_throughput: { # required
read_capacity_units: 10, # required
write_capacity_units: 300, # required
}
}
}
]
})