top
upGrad KnowledgeHut SkillFest Sale!

Search

AWS Tutorials

Amazon DynamoDB is a NoSQL database service that facilitates the user with quick performance and easy scalability. NoSQL basically refers to non-relational database which is highly available, scalable and optimized which provides high performance. Such databases use key-value pairs or document storage to manage their data.It provides fully managed operations such as administrative responsibilities, scaling a distributed database as well as a cluster, provisioning of required hardware, its set up, configuration, regular software updates when a patch comes in, and data replication which is essential for data backup and recovery. As a security measure, it provides data encryption which eliminates the burden of complexity from the user’s side to the service’s side. It makes sure that sensitive and private data is safe.IntroductionDynamoDB is a service that helps create database and data tables which help store data efficiently and efficiently retrieve any amounts of data and serve it as a response to the user by taking very short response times. The database tables can be scaled up or down hassle free without any reduction in its performance or downtime.The AWS Management Console helps monitor the resources, their performance, and their utilization. Since it supports replication, it provides on-demand backup abilities, wherein backups of all the tables present in the database can be taken, in addition to retaining and archiving them for long periods of time. Data can be recovered at specific points-in-time, right before a failure, or when the data is in a specific state. This makes sure that the tables are protected from accidentally being written to or deleted.It also provides ability to delete expired, irrelevant or outdated elements from data tables thereby making good usage of memory and making it cost-effective.The reason behind high-availability of data in the database while using DynamoDB is because it spreads the data and requests over multiple servers keeping in mind the throughput and storage requirements. Even during all this, the data is kept consistent and performance is never compromised on. Data is stored in SSDs (solid state drives) which means it is automatically replicated over multiple Availability Zones in a specific region, making sure data is most-of-the-times available and highly durable.DynamoDB helps in replicating data all by itself without interference from the user. All the required tasks to create the identical table in different regions are managed by DynamoDB. DynamoDB is most suited for huge applications that have a user base all over the globe. When the application is huge, DynamoDB helps reduce response times and improves performance irrespective of where the table is located or where the request is coming from.DynamoDB comes with an attribute known as DynamoDB steam, which is used to keep track of the modifications performed on the data inside the table. When this feature is enabled, every time an operation occurs (creation, updation or deletion of an item), an event is logged in.As with every other service offered by Amazon DynamoDB can be accessed with the help of one of the three resources-Amazon ConsoleCLI (Command Line Interface)APIAccessing the databaseBefore an application can access a database, it needs to be authenticated to make sure that it is valid and has the permissions to access the database. The database authorizes the application to ensure that the application performs actions for which it has permission. The below image shows how the client interacts with the relational database and a DynamoDB.Creating tables and loading dataData storage requirement is usually different for every application depending on how the data is related to each other and what attributes make them unique.Open the DynamoDB console.Click on ‘Create Table’ and the ‘Create DynamoDB table’ screen appears.Here, enter a ‘Table’ name and a primary Key in the place of ‘Partition Key’ and specify its type.After customizing all the setting according to your requirements, click on ‘Create’.Loading data into tablesData which is in the form of JSON can be loaded into tables. The Amazon CLI is used to load data into the tables of the database.First extract the data from JSON files and store it in the current directory.Type in the below command where ‘file://Reply.json’ is the path to your JSON fileaws dynamodb batch-write-item –request-items file://.json file nameVerify whether the data has been loadedOpen the DynamoDB console and click on ‘Tables’.Click on the database which you created previously.Click on the ‘items’ tab to see the data which you loaded into the tables.Click on the name you provided for the ‘partition key’ to view the contents.Querying the databaseOpen the DynamoDB console, and click on the ‘Tables’ tab in the navigation tab.In the list of tables, click on ‘Reply’.Click on ‘items’ tab to view the data which was loaded into the table.Click on the data filter, present right below ‘Create item’ option.In the data filter pane, change operation from ‘Scan’ to ‘Query’ and enter the ‘Partition Key’. Click on ‘Start’.Change the query source, enter a ‘Partition Key’ and click on ‘Start’.Salient features of DynamoDBIt is a web service that uses NoSQL database, and the interactions associated with it are stateless.This means applications can avoid maintaining persistent network connections. DynamoDB can be communicated with, with the help of HTTP/HTTPS requests and responses.Every request sent to the DynamoDB is secure, since it consists of a cryptographic signature that provides authentication for that specific request. DynamoDB has an SDK that provides all the logic required to create signatures and signing requests.Authorization is handled by AWS IAM. IAM policies can be specified, thereby granting specific permissions to specific users to access the DynamoDB resources.The result of request sent by user is a HTTP/HTTPS response that houses the result of the operation. In case of any error, DynamoDB returns the specific error status and a message alongside.ConclusionIn this post, we understood how DynamoDB works, its significance and how data tables can be created with the help of DynamoDB, how the data can be loaded into database, and how it can be queried.
logo

AWS Tutorials

How DynamoDB works - Amazon Web Services

Amazon DynamoDB is a NoSQL database service that facilitates the user with quick performance and easy scalability. NoSQL basically refers to non-relational database which is highly available, scalable and optimized which provides high performance. Such databases use key-value pairs or document storage to manage their data.

It provides fully managed operations such as administrative responsibilities, scaling a distributed database as well as a cluster, provisioning of required hardware, its set up, configuration, regular software updates when a patch comes in, and data replication which is essential for data backup and recovery. As a security measure, it provides data encryption which eliminates the burden of complexity from the user’s side to the service’s side. It makes sure that sensitive and private data is safe.

Introduction

DynamoDB is a service that helps create database and data tables which help store data efficiently and efficiently retrieve any amounts of data and serve it as a response to the user by taking very short response times. The database tables can be scaled up or down hassle free without any reduction in its performance or downtime.

The AWS Management Console helps monitor the resources, their performance, and their utilization. Since it supports replication, it provides on-demand backup abilities, wherein backups of all the tables present in the database can be taken, in addition to retaining and archiving them for long periods of time. Data can be recovered at specific points-in-time, right before a failure, or when the data is in a specific state. This makes sure that the tables are protected from accidentally being written to or deleted.

It also provides ability to delete expired, irrelevant or outdated elements from data tables thereby making good usage of memory and making it cost-effective.

The reason behind high-availability of data in the database while using DynamoDB is because it spreads the data and requests over multiple servers keeping in mind the throughput and storage requirements. Even during all this, the data is kept consistent and performance is never compromised on. Data is stored in SSDs (solid state drives) which means it is automatically replicated over multiple Availability Zones in a specific region, making sure data is most-of-the-times available and highly durable.

DynamoDB helps in replicating data all by itself without interference from the user. All the required tasks to create the identical table in different regions are managed by DynamoDB. DynamoDB is most suited for huge applications that have a user base all over the globe. When the application is huge, DynamoDB helps reduce response times and improves performance irrespective of where the table is located or where the request is coming from.

DynamoDB comes with an attribute known as DynamoDB steam, which is used to keep track of the modifications performed on the data inside the table. When this feature is enabled, every time an operation occurs (creation, updation or deletion of an item), an event is logged in.

As with every other service offered by Amazon DynamoDB can be accessed with the help of one of the three resources-

  1. Amazon Console
  2. CLI (Command Line Interface)
  3. API

Accessing the database

Before an application can access a database, it needs to be authenticated to make sure that it is valid and has the permissions to access the database. The database authorizes the application to ensure that the application performs actions for which it has permission. The below image shows how the client interacts with the relational database and a DynamoDB.

Accessing the database

Creating tables and loading data

Data storage requirement is usually different for every application depending on how the data is related to each other and what attributes make them unique.

  • Open the DynamoDB console.
  • Click on ‘Create Table’ and the ‘Create DynamoDB table’ screen appears.
  • Here, enter a ‘Table’ name and a primary Key in the place of ‘Partition Key’ and specify its type.
  • After customizing all the setting according to your requirements, click on ‘Create’.

Loading data into tables

Data which is in the form of JSON can be loaded into tables. The Amazon CLI is used to load data into the tables of the database.

  • First extract the data from JSON files and store it in the current directory.
  • Type in the below command where ‘file://Reply.json’ is the path to your JSON file
aws dynamodb batch-write-item –request-items file://.json file name

Verify whether the data has been loaded

  • Open the DynamoDB console and click on ‘Tables’.
  • Click on the database which you created previously.
  • Click on the ‘items’ tab to see the data which you loaded into the tables.
  • Click on the name you provided for the ‘partition key’ to view the contents.

Querying the database

  • Open the DynamoDB console, and click on the ‘Tables’ tab in the navigation tab.
  • In the list of tables, click on ‘Reply’.
  • Click on ‘items’ tab to view the data which was loaded into the table.
  • Click on the data filter, present right below ‘Create item’ option.
    Querying the database
  • In the data filter pane, change operation from ‘Scan’ to ‘Query’ and enter the ‘Partition Key’. Click on ‘Start’.
    Amazon DynamoDB
  • Change the query source, enter a ‘Partition Key’ and click on ‘Start’.

Salient features of DynamoDB

  • It is a web service that uses NoSQL database, and the interactions associated with it are stateless.
  • This means applications can avoid maintaining persistent network connections. DynamoDB can be communicated with, with the help of HTTP/HTTPS requests and responses.
  • Every request sent to the DynamoDB is secure, since it consists of a cryptographic signature that provides authentication for that specific request. DynamoDB has an SDK that provides all the logic required to create signatures and signing requests.
  • Authorization is handled by AWS IAM. IAM policies can be specified, thereby granting specific permissions to specific users to access the DynamoDB resources.
  • The result of request sent by user is a HTTP/HTTPS response that houses the result of the operation. In case of any error, DynamoDB returns the specific error status and a message alongside.

Conclusion

In this post, we understood how DynamoDB works, its significance and how data tables can be created with the help of DynamoDB, how the data can be loaded into database, and how it can be queried.

Leave a Reply

Your email address will not be published. Required fields are marked *

Comments

tenzin nyima

Whoever has contributed to this article...I would like to say thank you... it has been of good help to the readers.

alvi

This blog is very helpful and informative, and I really learned a lot from it.

alvi

It is very helpful and very informative, and I really learned a lot from this article.

alvi

Such a very useful article. I would like to thank you for the efforts you made in writing this awesome blog.

Jeanne

Very useful and awesome blog!