AWS DynamoDb –A Serverless, Key-value & NoSQL database
Amazon DynamoDB is a fully managed, serverless, key-value, NoSQL database designed to run high-performance applications at any scale. DynamoDB offers built-in security, continuous backups, automated multi-Region replication, in-memory caching, and data export tools.
Use cases:
- Develop Software Applications
- Create media metadata stores
- Deliver seamless retail experiences
Key terms:
- Serverless: Serverless architecture allows developers to build and run services without having to manage the underlying infrastructure. There are still have server that Cloud vendor is responsible for that infrastructure.
- NoSQL: NoSQL is known as a non-relational database that provides a process for storage and retrieval of data. The data stores in a variety of ways such as documents, key-value, wide-column, and graphs.
AWS DynamoDB Project prerequisites:
o AWS account with IAM User
o IAM user with permission
o You need to know how to create EC2 instance on AWS
Srep1: Create a DynamoDB Table:
Go to AWS Console → Search for DynamoDB → click Create Table
o Fill out the table details with a Table name and Partition key name. The Partition key is a part of the table’s primary key. The partition key section states what we’re going to store in this table and this can be a string, binary, or a number. The Sort key is optional
o Keep the Table setting as a default
o You can also skip the Tags part for now
o Once you click on create table, it will create a table.
o The table Demo_Table2 has been created successfully.
Now, Click on the name of the table and from the right corner Action tab click on the drop down and select create item and type below information’s.
User_id 1234
first_name John
last_name Robert
favorite_number 10
Then hit create item from the bottom right corner. Now successfully Demo_Table2 has been created with the data has been provided. Then create another item same way with the below information:
User_id 5678
first_name John
last_name Doe
favorite_number 15
Step 2: Create an EC2 Instance:
Go to AWS Console → Search for EC2 → Create EC2 instance → Configure instance details →Launch Instance
Step 3: Grant EC2 Instance read access to DynamoDB
Create new IAM Role named on DynamoDb_ReadOnly_Access → Attach the DynamoDB read-only permissions to the IAM user
Step 4: Connect EC2 with web cli
Now, go to EC2 instance from the AWS console → select the EC2 instance → click the dropdown from the Action tab → click connect. It will connect the aws cli with the EC2 instance in a different tab
Step 5: Scan the DynamoDB table => Demo_Table2 by using the AWS CLI in EC2 Instance
This cli command will scan operation to return all the data attributes for each item in the Demo_Table2 table. If you want to insert, delete and update the data, you have to give the IAM user write permission.
Happy Learning !!
Conclusion:
I had some issues of naming table, figured out I already had a table with the same table name : ) . I have deleted old table and create a new one fixed the issue. Table name can’t be duplicate.