AWS: Cannot perform more than one GSI creation or deletion in a single update

Viewed 4934

So I've been encountering this issue during serverless deployment:

ServerlessError: An error occurred: MyDdbTable - Cannot perform more than one GSI creation or deletion in a single update.

My DDB table configuration is this: Configuration in serverless.yml

      AttributeDefinitions:
          - AttributeName: externalId
            AttributeType: S
          - AttributeName: code
            AttributeType: S
          - AttributeName: accountId
            AttributeType: S
        KeySchema:
          - AttributeName: externalId
            KeyType: HASH
          - AttributeName: code
            KeyType: RANGE
        GlobalSecondaryIndexes:
          - IndexName: gsi-account-id
            KeySchema:
              - AttributeName: accountId
                KeyType: HASH
              - AttributeName: code
                KeyType: RANGE
            Projection:
              ProjectionType: ALL
          - IndexName: externalId
            KeySchema:
              - AttributeName: externalId
                KeyType: HASH
            Projection:
              ProjectionType: ALL
          - IndexName: code
            KeySchema:
              - AttributeName: code
                KeyType: RANGE
            Projection:
              ProjectionType: ALL

Additional information:

  • One (1) index is already existing which is the gsi-account-id where it has two (2) keySchema, accountId and the code
  • I added two (2) additional index which are externalId and code

Objective/s:

My goal is to add those two (2) additional indexes (externalId and code) but upon doing a serverless deployment, I always encounter the issue said above.

Questions:

  1. Do I encounter this issue because the code is already existing in the first's keySchema (gsi-account-id)?
  2. Do you have any idea/suggestion on why do I encounter this issue if the #1 is not the answer?

Thank you for those who'll help me on this. ❤️

1 Answers
Related