0
votes

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
          }
        }
      }
    ]
  })
1
How many GSIs do you have on this table? Probably, other GSIs have ProjectionType of INCLUDE and it exceeds 20 attributes. Could you please execute describe table command and include that result on the post? - notionquest
you were right. It was due to another GSI - Niels Kristian

1 Answers

0
votes

Turned out that the attribute limit restriction goes across all GSI's on the table. I had another one that caused this one to fail. Deleted that one, and then it worked.