Open In App
Related Articles

AWS DynamoDB – Read Data from a Table

Improve Article
Save Article
Like Article

AWS DynamoDB is a NoSQL managed database that stores semi-structured data i.e. key-value and document data. It stores data in form of an item. An item consists of attributes. Upon table creation in DynamoDB, it only requires a primary key to differentiate between items and no schema is to be defined. Each item can have a different number of attributes. 

Amazon DynamoDB is a fully managed, serverless database and key-value pair NoSQL database that is designed for running the high-performance applications at any scale. So, DynamoDB also offers many built-in security,  continuous backups, multi-Region replication and in-memory caching. Disney, Dropbox, zoom, Snapchat are the customers of DynamoDB. Amazon DynamoDB has SLA of upto 99.99% of Availability. so, when the user uses the amount of data scaling, JOINs and some advanced SQL operations, this will lead to slow down in your queries. And With DynamoDB, the queries of users will shows the predictable latency upto any size, this may includes over 100 TBs!. DynamoDB is the simple key-value pair that accesses the patterns so as to make the fast, reliable choice.

Example 1:
  "ArticleID": 1,
  "NameofArticle": "DynamoDB"

Example 2:
  "ArticleID": 3,
  "NameofArticle": "Cloudwatch",
  "Service": "AWS"

To read data from a DynamoDB table, there are 3 ways:

  1. get-item – This is used in AWS Command Line Interface (CLI). To retrieve an item you must specify a table name and keys that you want to retrieve.
  2. Query – The items in the table can be retrieved by querying on the table. While querying, it by default contains the primary key as a search filter. More attributes can be added to refine search.
  3. Scan – It is similar to the query. The only difference is that it doesn’t have any attribute by default for searching. To search an item, you must define an attribute, and its value to find the item.


  • Create Table and Items: To read data from a table, the table and data inside the table should exist. In this example, a table named geeksforgeeks has already been created with few items inside it. See the below image:

Read Data from Table:

To read data through Amazon Console we have two ways.

  • Scan Method: To use the scan method, select Scan from the dropdown. Then in the filter add one attribute. In this example, we want all the articles written by Rohan Chopra. Therefore, add attribute WrittenBy as the filter and enter the value as ‘Rohan Chopra’. Click on start search to get results. See the below image:

  • Query Method – To use the query method, select Query from the dropdown. By default, we will have our partition key as one search filter. We can add more attributes in the filter to refine our search. In the following image, we see that partition key ArticleID is already present. But we also add one more search filter i.e. Service.

The following image is of the invalid query. The query contains ArticleID=2 and Service=’AWS‘. 

We see that the item ArticleID=2 does not have any attribute as Service. Therefore, no records were found.

Last Updated : 28 Mar, 2023
Like Article
Save Article
Similar Reads
Related Tutorials