Attempting to modify a GSI that is being created

TL;DR — While a global secondary index is in its build phase (IndexStatus = CREATING), DynamoDB won't let you modify that index, add or delete other indexes, change throughput, or delete the table. Wait until the GSI reaches ACTIVE, and make GSI changes one at a time — you can't create and modify indexes in the same UpdateTable.

What it means

ValidationException: Attempting to modify a GSI that is being created

Creating a GSI on a populated table triggers a backfill — DynamoDB replays existing items into the new index in the background. Throughout that phase the index's IndexStatus is CREATING. During the backfill DynamoDB rejects further structural changes to the index or table so the build stays consistent. It's an HTTP 400 ValidationException; retrying immediately fails until the index finishes.

Why it happens

  • Overlapping index operations — an UpdateTable (or an IaC apply) tries to modify/delete a GSI, or add a second one, while the first is still building.
  • CloudFormation/Terraform batching — the tool attempts multiple GSI changes in a single update; DynamoDB allows only one GSI create or delete per UpdateTable.
  • Throughput change mid-build — trying to adjust provisioned capacity on a table whose GSI is still CREATING.
  • Deleting the table too soon — a teardown that races the backfill.

How to fix it

  1. Wait for ACTIVE. Poll DescribeTable and check each GlobalSecondaryIndexes[].IndexStatus; only proceed once it's ACTIVE.
    aws dynamodb describe-table --table-name <Table> \
      --query "Table.GlobalSecondaryIndexes[].{Name:IndexName,Status:IndexStatus}"
  2. Sequence index changes — one create/delete per UpdateTable; don't add a new GSI while another is building.
  3. In CloudFormation/Terraform, split GSI additions across separate deploys so each backfill completes before the next change.
  4. Defer throughput/table edits on that table until the index is ACTIVE.

无需控制台即可使用 DynamoDB

DynoTable 是面向 DynamoDB 的快速桌面客户端 —— 浏览表、运行 SQL 风格的查询,并在本地编辑项。