Amazon DynamoDB is a key-value and document database that can provide single-digit millisecond performance. It is fully managed, highly scalable, and has built-in security and backup. It can be used to deploy a simple NoSQL database that does not require a fixed schema like relational databases.

Some use cases on NoSQL databases and DynamoDB include serverless web applications, mobile backends, game backends, microservices, retail, banking, and many more. DynamoDB is used by some of the biggest players out there, including Samsung and Netflix.

In this piece, we will go through how to create a simple table using DynamoDB, and how to add, query, delete and scan data in that table. We will be using the scenario of a supermarket.

Prerequisites

1. Creating Your Table

First, go to the DynamoDB console from your AWS Management Console. Click “Create Table”.

image.png

For this use case, we will be pretending to be a supermarket. For Table Name, type “Supermarket”. Type “Category” in Primary Key and check “Add Sort Key”, entering “Food” as seen below. Make sure to check “Use default settings”. Click “Create”

image.png

You have created your first table in DynamoDB!

2. Adding, Querying and Deleting Data in your Table

To add data to your table, click on “Create Item” under the “Actions” dropdown.

image.png

You will then be presented with a window for you to input the data of your new item. For Category, type “Dairy” and for Food, type “Milk”. Click Save to create the item.

image.png

Try creating a few more items, these are the ones I used if you would like to copy them: