This lab goes through a process of creating a DynamoDB Table and using a Global Secondary Index to Fetch Data


Services Covered

  • dynamodb DynamoDB

Lab description

This lab goes through a process of creating a DynamoDB Table and using a Global Secondary Index to Fetch Data


Learning Objectives

  • Create DynamoDB table
  • Fetch data using Global Secondary Index

Lab date

17-12-2021


Prerequisites

  • AWS account

Lab steps

  1. Create a DynamoDB Table.
  2. Once the table is created create an item in that table.

    Add two more String attributes: ReturnDate and UserAmount. In JSON format it might look something like that:

    {
     "UserName": {
       "S": "Dune"
     },
     "OrderId": {
       "S": "2021-12-17-1349"
     },
     "ReturnDate": {
       "S": "20211222"
     },
     "UserAmount": {
       "S": "19.99"
     }
    }

    Create an item.

  3. Navigate to the Tables and then Indexes and create new Index. Enter the Partition key as ReturnDate and Sort key as UserAmount
  4. Add few more items into your table.
  5. Scan the table using the SGI created in step 3.

Lab files

  • []()

Acknowledgements

Tags: