Working with DynamoDB Local and Global Indexes

30 minutes
  • 4 Learning Objectives

About this Hands-on Lab

In this lab, we will explore DynamoDB Local and Global secondary indexes, and their impact on performance and capacity unit usage.

An existing unindexed table is provided, and we will create a new table with Local and Global secondary indexes. Load the same dataset into our new table with a provided data loader, then use a test utility to observe the performance and capacity differences when performing read operations against tables with and without indexes.

**Note: Use the `us-east-1` region for this lab.**

Learning Objectives

Successfully complete this lab by achieving the following learning objectives:

Create a New Table with Local and Global Secondary Indexes
  • Log in to the AWS Web Console for the lab environment at the provided URL with the supplied credentials.
    Note: Use the us-east-1 region for this lab.
  • Create a new DynamoDB Table named album_indexed with a Partition Key of artist_id and a Sort Key of id. Add a Local secondary index for the format attribute, and create a Global secondary index for the title attribute.
Log In to the EC2 instance and Load Data into Your Newly Created Table
  • Log in to the provided EC2 instance with the provided IP and credentials.
  • Run the index_table_load command to load data into your table.
Verify the Table Contents and Test Querying Against the Indexes You Created
  • Return to the AWS Web Console and verify the data has been loaded to the album_indexed table. Test querying against the title and format indexes.
Run the Provided Test Utility and Observe the Results
  • Return to the provided EC2 instance, run the provided pineheadrecords_query command, observe the results of the scan/filter against the album table, and query against the album_indexed table.

Additional Resources

The client our company has a contract with has launched its online vinyl record store. Unfortunately, several read operations are proving slow and expensive after the migration from MySQL to DynamoDB. The company has requested we test the impact of Local and Global secondary indexes for the dataset. Two operations are particularly problematic, and the development team down the hall has created a test utility that performs the troublesome scan/filter operations against the existing album table. They've also written query functions that are performed against the album_indexed table when it is present, while assuming there is a Local secondary index on the format attribute and a Global secondary index on the title attribute. The client is hoping the cost and performance of returning all albums of a specific format by a specified artist and returning data from the table by album title will improve through the addition of secondary indexes.

Once the table has been created with the partition key of artist_id and sort key of id, as well as a Local secondary index on the format attribute and a Global secondary index on the title attribute, we will load data into the table from the provided EC2 instance with the following command:

index_table_load

Then run the provided test utility with the following command:

pineheadrecords_query

What are Hands-on Labs

Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.

Get Started
Who’s going to be learning?

How many seats do you need?

  • $499 USD per seat per year
  • Billed Annually
  • Renews in 12 months

Ready to accelerate learning?

For over 25 licenses, a member of our sales team will walk you through a custom tailored solution for your business.


$2,495.00

Checkout
Sign In
Welcome Back!

Psst…this one if you’ve been moved to ACG!