Exploring Amazon DynamoDB Global Secondary Indexes | Scribe

    Exploring Amazon DynamoDB Global Secondary Indexes

    • Hafeez Baig |
    • 13 steps |
    • 2 minutes
    information ordinal icon

    Refer to the following guide to learn how to use IAM in the cloud\ <https://scribehow.com/shared/Creating_an_IAM_User_and_User_Group_in_AWS_Management_Console__hWNiiXlcRJKFqYZZEJD-cg> Refer to this guide to learn how to create items in DynamoDB tables\ <https://scribehow.com/shared/Exploring_Amazon_DynamoDB_Tables__BN34sTuvRG-hiypEyZr7sg>

    1

    Sign in to **AWS Management Console** as an **IAM User** **Pre-requisite** - Ensure you have selected the AWS region closest to your location\ For this guide, we will be using us-east-2 (Ohio) as a preferred choice

    2

    Type **DynamoDB** in the search bar and click on **DynamoDB** to view the **DynamoDB** Dashboard

    information ordinal icon

    **What is DynamoDB in AWS?** DynamoDB is a fully managed NoSQL database service provided by AWS. It offers high performance, scalability, and reliability for applications that require low-latency data access at any scale. DynamoDB is designed to handle large volumes of data and supports both document and key-value data models.

    3

    On the **DynamoDB** dashboard, click on **Tables** from the left bar to view the Tables

    information ordinal icon

    **What are Tables in DynamoDB?** In DynamoDB, tables are the primary data storage structures where you store and organize your data. Each table consists of items, which are individual records, and each item contains attributes, which are key-value pairs. Tables in DynamoDB are schema-less, meaning that different items within the same table can have different attributes.

    4

    **Tables** wizard will open, select the Name **todo**

    5

    **todo** wizard will open, click on the **Monitor** tab to view the **Alarms**

    information ordinal icon

    **What are Alarms in DynamoDB?** In DynamoDB, alarms are used to monitor the performance and health of your DynamoDB tables. You can set up alarms to trigger notifications when certain conditions are met, such as when a table's read or write capacity exceeds a specified threshold, or when there are throttling errors.

    6

    Click on the **Indexes** tab to view **Global secondary indexes**

    information ordinal icon

    **What are Global secondary indexes in DynamoDB?** Global secondary indexes (GSIs) in DynamoDB are additional indexes that you can create on your table to provide more querying flexibility. Unlike the primary key, which consists of a partition key and an optional sort key, GSIs allow you to define alternative key attributes for querying the data in your table.

    7

    On the right side click on the **Create index** button

    8

    **Create global secondary index** wizard will open, type "**user**" for the **Partition key** and "**user-index**" for Index name

    9

    Scroll the page and click on the **Create index** button

    10

    Successfully submitted the request to create your index

    information ordinal icon

    Congratulations on successfully sending the request to create the secondary index in DynamoDB! Well done!

    11

    To Run a Query for an index, click on the **Explore items** from the left bar

    12

    On the **Explore items** wizard, select the **Query** radio button and for **Select a table or index** click on the **user-index** from the dropdown which we created earlier

    13

    Scroll to the **user (Partition key)** section, type "**Ranga**" in the text input field and click on the **Run** button to run the query **Note:** The Partition key and items were already added while creating the table.

    information ordinal icon

    You can view the query results in the "Items returned" section. Congratulations on creating the global secondary index and completing this lab! Well done!