DynamoDB Read Operation Performance

Hands-On Lab

 

Photo of Fernando Medina Corey

Fernando Medina Corey

Training Architect

Length

00:30:00

Difficulty

Intermediate

In this hands-on lab, we will learn how to optimize read operations effectively when interacting with a DynamoDB table. Specifically, we will compare the use of read operations, like scans and queries, and how using each of them impacts the required Read Capacity Units.

What are Hands-On Labs?

Hands-On Labs are scenario-based learning environments where learners can practice without consequences. Don't compromise a system or waste money on expensive downloads. Practice real-world skills without the real-world risk, no assembly required.

DynamoDB Read Operation Performance

Introduction

In this hands-on lab, we will learn how to optimize read operations effectively when interacting with a DynamoDB table. Specifically, we will compare the use of read operations, like scans and queries, and how using each of them impacts the required read capacity units.

Log in to the AWS Management Console using the credentials provided on the lab instructions page.

In a new browser tab or window, log in to the Jupyter Notebook using the credentials provided on the lab instructions page. On the Jupyter home page, click the dynamodbReadPerformance.ipynb file to open it.

Create a DynamoDB Table

  1. In the Jupyter Notebook, select the first code cell and click Run.
  2. Select the second code cell and click Run.
  3. Switch to your AWS Management Console tab, and navigate to the DynamoDB service.
  4. Click Tables in the left sidebar.
  5. A table called movies should be listed with a status of Creating.

Load Data into the DynamoDB Table

  1. When the status of the table changes to Active, go back to the Jupyter Notebook.
  2. Select the third code cell and click Run.
  3. Go back to the AWS Management Console, and click the name of the movies table to open it.
  4. In the movies menu on the right side of the screen, click the Items tab to view the data in the table.

Scan the Table

  1. Go back to the Jupyter Notebook.
  2. Select the fourth code cell and add # in front of ConsistentRead=True.
  3. Click Run.
  4. Scroll back up to the third code cell and locate the line that includes # add a +1 to this the second time around.
  5. Edit the code to add additional data to the table (add + 1 after year).
    'year': year + 1, # add a +1 to this the second time around.
  6. Click Run.
  7. Edit the code to add additional data to the table (add + 2 after year).
    'year': year + 2, # add a +1 to this the second time around.
  8. Click Run.
  9. Edit the code to add additional data to the table (add + 3 after year).
    'year': year + 3, # add a +1 to this the second time around.
  10. Click Run.
  11. Scroll down to the fourth code cell and click Run.
  12. In the fourth code cell, remove the # in front of ConsistentRead=True.
  13. Click Run.

Query the Table

  1. In the Jupyter Notebook, select the fifth code cell and click Run.
  2. In the fifth code cell, add ConsistentRead=True beneath the line that begins with KeyConditionExpress=Key.
  3. Add a comma to the end of the previous line.
  4. Click Run.

Conclusion

Congratulations, you've successfully completed this hands-on lab!