Skip to main content
Launch this lab in the IP Lab Portal, then follow the steps below in the AWS console. Open IP Lab Portal

Overview

Lab details

  1. This lab walks you through Amazon DynamoDB features. We will create a table in Amazon DynamoDB to store information and then query that information from the DynamoDB table.
  2. Duration: 30 minutes
  3. AWS Region: US East (N. Virginia) us-east-1.

Introduction

What is AWS DynamoDB?

Definition
  • DynamoDB is a fast and flexible NoSQL database designed for applications that need consistent, single-digit millisecond latency at any scale. It is a fully managed database, and it supports both document and key value data models.
  • It has a very flexible data model. This means that you don’t need to define your database schema upfront. It also has reliable performance.
  • DynamoDB is a good fit for mobile gaming, ad-tech, IoT and many other applications.
DynamoDB Tables
DynamoDB tables consist of
  • Items (Think of a row of data in a table).
  • Attributes (Think of a column of data in a table).
  • Supports key-value and document data structures.
  • Key= the name of the data. Value= the data itself.
  • The document can be written in JSON, HTML, or XML.
DynamoDB- Primary Keys
  • DynamoDB stores and retrieves data based on a Primary key
  • DynamoDB also uses Partition keys to determine the physical location data is stored.
  • If you are using a partition key as your Primary key, then no items will have the same Partition key.
  • Composite Keys (Partition Key + Sort Key) can be used in Combination.
  • Two items may have the same partition key, but must have a different sort key.
  • All items with the same partition key are stored together and then sorted according to the sort key value.
  • DynamoDB allows you to store multiple items with the same partition keys.

Architecture diagram

Tasks Details

  1. Sign in to AWS Management Console.
  2. Create a DynamoDB table.
  3. Insert data into that DynamoDB table.
  4. Search for an item in the DynamoDB table.
  5. Validation of the lab

Launching the lab environment

  1. To launch the lab environment, Click on the Launch lab button.
  2. Please wait until the cloud environment is provisioned. It will take less than a minute to provision.
  3. Once the Lab is started, you will be provided with IAM username, Password, Access Key, and Secret Access Key.
You can only start one lab at any given time

Lab guide

Lab steps

Task 1: Sign in to AWS Management Console

  1. Click on the Open console button, and you will get redirected to AWS Console in a new browser tab.
  2. On the AWS sign-in page,
  • Leave the Account ID as default. Never edit/remove the 12-digit Account ID present in the AWS Console. Otherwise, you cannot proceed with the lab.
  • Now copy your Username and Password in the Lab Console to the IAM Username and Password in AWS Console and click on the Sign-in button.
  1. Once Signed In to the AWS Management Console, make the default AWS Region as US East (N. Virginia) us-east-1.
If you face any issues, please go through FAQs and Troubleshooting.

Task 2: Create DynamoDB Table

In this task, we are going to create a DynamoDB table.
  1. Make sure you are in the US East (N. Virginia) us-east-1 Region.
  2. Navigate to DynamoDB page by clicking on the Services menu at the top. DynamoDB is available under the Database section.
  3. Click on Create table button
  • Table Name: Enter mydynamodbtable
  • Partition key: Enter companyid and select Number
  • Add sort key: Enter name in the respective field and select String.
  • The combination of a Partition Key and a Sort Key uniquely identifies each item in a DynamoDB table.
  • Leave all the other settings as default and then click on Create table.
  1. Your table will be created within 2–3 minutes.

Task 3 : Inserting Data into DynamoDB Table

In this task, we are going to insert data into a DynamoDB table. By adding data to the table, we will understand how to populate it with relevant information.
  1. Next, we are inserting data in the table we created.
  2. Select mydynamodbtable and then Click on the Explore table items button.
  1. Now click on Create item button.
  1. Add new Partition key and sort key values.
    • companyid : Enter 1
    • name : Enter John
  2. After entering the data, click on the Create item button, present on the right bottom corner.
  3. For testing purposes, add 4–5 items as shown in the above step and click on the Create item button.

Task 4 : Search for Items in the Table

In this task, we are going to query capabilities of DynamoDB. By using the scan operation.
  1. We will query the items in our table by using scan.
  2. Select Query
  1. In the query window, enter the partition key and sort key which you want to search.
    • Partition Key = Enter 4
    • Sort Key = Enter Sarah
    • Click on Run.
  2. You will be able to see a result table with your filtered records. A sample screenshot is given below:
  1. You can search with the Partition Key and the Sort Key. Try some additional test cases yourself to become more familiar with these keys.
Do you know?DynamoDB was originally developed by Amazon to meet the demands of their e-commerce platform during the holiday shopping season. The system needed to handle the sudden spike in traffic and maintain low latency for a large number of concurrent users. DynamoDB’s design principles and scalability were tested and proven in this high-stakes environment, ensuring its reliability and performance even under extreme load conditions.

Task 5 : Validation Test

  1. Once the lab steps are completed, please click on the Check my work button on the left side panel.
  2. This will validate the resources in the AWS account and displays whether you have completed this lab successfully or not.
  3. Sample output :

Completion and conclusion

  1. You have successfully created an Amazon DynamoDB table.
  2. You have inserted multiple items into the table using a partition key and sort key.
  3. You have successfully searched for items in the table using the partition and sort keys.

End lab

  1. Sign out from the AWS Management Console.
  2. Click on End lab button in the IP Lab Portal and wait till the process gets completed

What gets checked

When you press Check my work, the platform verifies each of these:
  • Create Amazon DynamoDB Table — Check whether a DynamoDB Table is created or not.
  • Create Items in DynamoDB Table — Check whether items in the DynamoDB table are created or not.