Cook a recipe with AWS: Dynamo DB Table
Tags: cloud, aws, webdev, beginners
Published: 2022-12-02 17:51:13


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fkbrjroxr22uzq8qyfy6.jpg)


## DynamoDB
**Amazon DynamoDB** is a fully managed **NoSQL database** with which  you can create database tables  that can store and retrieve any amount of data and serve any level of request traffic.

**DynamoDB is a schema-less database** that requires only a **table name and a primary key when you create the table.**

Lets get started with DynamoDB and create a table to store the details of students

## Prerequisites
Log into AWS account with a valid user credentials
(Root user not preferred)

## Lets Jump to the Recipe now

**<u> Steps to create </u>**

-  Open the DynamoDB from the aws console

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/97bv3er3v28b9b3jsyyb.png)



-  Click on the **create table** button
 

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/oxvu7y4zyxvmiivb71y7.png)

> Remember, **DynamoDB is a schema-less database that requires only a table name and a primary key when you create the table.**
- Specify the **table name**, My table name is going to be student_table since student details are being stored

- Now,Lets Specify the **Partition key**. I am going to add Student_Id  as the partition key. 

- Select the data type as Number

> The **partition key** is part of the table's **primary key** which  is a hash value that is used to retrieve items from your table and allocate data across hosts for scalability and availability.

We can also specify the **sort key** for the table but its **optional**

> **The sort key allows you to sort or search among all items sharing the same partition key.**

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ftuz77jn5e5kkwc2917i.png)

Now, Scroll down and Make sure the Default Settings is selected for the Table settings

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bp5yonszze2esteq8w7n.png)


- Click **Create table** button 


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/77wketjkkfavwvnvkaz8.png)



You can see the status as **"Creating"**. 

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/sw1qbxzirb9hrmqye7ig.png)



Now lets wait for couple of minutes to get the status changed to **Active**

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/45bxpm3qpd7dy6wtxfhh.png)



Once the table status changed to Active
click on the table name link and you will be navigated to the table page. 


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fwphvngqrhn49x213hay.png)
Lets add some items Student details to the table
- Click on Actions Button
- Select **Create Item**

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/montccmh368jbiqhj1o5.png)



Lets add the below students to the table

Studentid: 101
Name: Jade


Name is the **additional  attribute** where as studentid is the partionkey attribute

Specify the value of partition key and click on Add new Attribute button to add the Name attribute. Select String Type

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/au9fl5muyakjwtauhbh4.png)




Change the attribute name to Student_Name
Specify the value as "Jade"

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7npa4zdbw1ouk9hyv4hc.png)



This is the Form View, You can click the **JSON View button to see the json version**

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8421wdny02zc5luhp6o6.png)



- Click **Create item**



![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/oqd087wd870qnd4wgyeg.png)






- You can see item getting added to the table

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vxm3gco2gd6knbh4y4cf.png)