Local secondary indexes must be specified at table creation

TL;DR — A local secondary index (LSI) can only be created at the moment its table is created; it cannot be added, changed, or removed afterward. UpdateTable has no operation for LSIs, so any attempt to add one to a live table fails validation. To get a new LSI you must create a new table (with the LSI) and migrate the data — or use a global secondary index (GSI), which can be added online.

What it means

ValidationException: One or more parameter values were invalid: Local secondary
indexes can only be created when a table is created

An LSI shares its partition key with the base table and adds an alternate sort key; DynamoDB co-locates it with the item's partition at write time. Because of that physical coupling, an LSI must exist from the table's first write — UpdateTable supports adding/removing GSIs but has no LSI parameter at all, so there is no request you could even send to retrofit one. The exact message varies by path (an SDK/CLI call may fail parameter validation client-side; IaC tools surface their own wording), but the service-side form is an HTTP 400 ValidationException and it is not retryable: the operation simply isn't supported on an existing table.

Why it happens

  • Adding an LSI to a live table — calling UpdateTable (or editing a CloudFormation/Terraform template) to introduce a new LocalSecondaryIndexes entry on a table that already exists.
  • Changing an existing LSI — its key schema or projection is fixed at creation; edits are rejected.
  • An IaC diff that recreates vs. updates — the tool tries to update-in-place an LSI change that DynamoDB only allows at create time.

How to fix it

  1. Create a new table with the LSI defined up front, then migrate data (scan-and-write, or an on-demand export/import).
  2. Use a GSI instead if the access pattern allows it — GSIs can be added to an existing table online and don't require the same partition key:
    aws dynamodb update-table --table-name <Table> \
      --attribute-definitions AttributeName=gsi_sk,AttributeType=S \
      --global-secondary-index-updates '[{"Create":{"IndexName":"gsi1", ...}}]'
  3. Plan LSIs during modeling — decide alternate sort keys before the table exists, since they can't be retrofitted.
  4. Model the access pattern in a GSI first. If the query works on a GSI with a different partition key, you avoid a table rebuild entirely.

Check size in DynoTable

Before you rebuild a table for an LSI, validate the access pattern in DynoTable — open the table with ⌘K and test whether a GSI query covers the same need. The Query Builder generates the KeyConditionExpression your new index must serve.

Use the pricing calculator to compare LSI write amplification against a GSI alternative. Switch profiles with ⌘P; see Connect to AWS and Install.

Sources

References

Last verified 2026-07-13 against the official AWS documentation linked above.

Work with DynamoDB without the Console

A fast DynamoDB desktop client that runs the real SQL DynamoDB can’t — JOINs, GROUP BY, aggregates — with visual editing and an AI agent on your own Bedrock keys.

Free 30-day trial, no credit card — then the Free plan with no time limit.