anderwald
anderwald

Reputation: 149

How can I create a local secondary index in AWS DynamoDB?

i am trying to create a local secondary index via the management console. After selecting the desired table in DynamoDB, I choose the "index" tab and click "Create Index". Then I am prompted with the following UI. I cannot state, if the index should be local or global. AWS does not automatically check, wheter the index partition key equals the table partition key. Even when it is the same partition key, AWS specifies the Index as "GSI" instead of "LSI". I can configure a local secondary index via the cli correctly - this works perfectly fine.

I was just wondering, can you actually do this right in the management console? aws UI for index Creation

Upvotes: 4

Views: 6091

Answers (2)

daniel blythe
daniel blythe

Reputation: 1048

If you would like to know how to add an LSI at creation time in the management console, please see below.

But it is very simple. When on the create table page in the console, in the Table settings click Customize settings. Then you just need to scroll down the page past the Read/write capacity settings section.

The next section will be the Secondary indexes section. From here you can create secondary indexes.

enter image description here

Upvotes: -1

Chris Williams
Chris Williams

Reputation: 35156

You cannot create on an existing DynamoDB table, from the AWS documentation:

To create one or more local secondary indexes on a table, use the LocalSecondaryIndexes parameter of the CreateTable operation. Local secondary indexes on a table are created when the table is created. When you delete a table, any local secondary indexes on that table are also deleted.

You would need to either use a global secondary index, or migrate to a new table that you create the LSI at create time.

Upvotes: 10

Related Questions