AWS DynamoDB – Create a Global Secondary Index
Amazon DynamoDB is a NoSQL-managed database that stores data in the form of key-value pairs and document data. A Dynamodb table stores items which are nothing but key-value pairs. By default, each item will have a partition key to differentiate between the items.
When need to perform many kinds of queries, taking different attributes as query criteria, then you can create one or more global secondary indexes and issue Query requests against these indexes in Amazon DynamoDB.
For example, a table named movies have been created in DynamoDB. See the below image:
Create a global secondary index:
To create a secondary index in DynamoDB follow the below simple steps:
Step 1: Click on the name of the table. Navigate to the Indexes tab of the table. Click on create index button.
Step 2: Provide the primary key name. In this case, we have provided the Name. The index name is more of a table name. Thus, when we add a secondary global index and the results obtained upon query are stored in the specified index name. Rest leave everything as default. Click create index button.
In the above images, we see that a secondary global index has been created with the name Name-index.
Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, GeeksforGeeks Courses
are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out - check it out now!