2021 Offer : Pay for 1 & Get 3 Months of Unlimited Class Access

- AWS Blogs -

What Is Amazon DynamoDB? How Does It Work?

In the vast era of information technology, web, mobile, gaming, and Internet of Things are the top trends that are popular among the modern generation. Amazon’s DynamoDB is the top database solution among cloud computing environment. All the applications that need low-latency data access, DynamoDb is the solution. In this blog post, we will learn the fundamentals of DynamoDB, it's working, and a few of the fundamental concepts.

What Is Amazon DynamoDB?

Amazon DynamoDB is a fully managed NoSQL database service that provides fast and predictable performance with seamless scalability. It lets you offload the administrative level burden of operating and scaling a distributed database so that you don’t have to worry about hardware provisioning, setup, and configuration, replication, software patching, or cluster scaling. Amazon DynamoDB offers encryption at rest, which eliminates the operational burden and complexity involved in the protection of sensitive information.

With the help of Amazon DynamoDB, we can easily create database tables that can store and retrieve any quantity of data and serve traffic request of any level. You may also scale up and scale down your table throughput capacity without any downtime or degradation of performance. With the use of the AWS management console, you can easily monitor the utilization of resource and performance results.

Amazon DynamoDB has great benefits. One of the top benefits is you can easily take backup and restore your database on-demand without even degrading the performance or availability of your applications. It makes use of a new and unique distributed technology that allows you to complete backups in seconds only depending upon the table size. You can take backups that are consistent within seconds across thousands of partitions without worrying about long-running backups processes or schedules. All backups are systemized, easily searchable, and retained until explicitly deleted.

Accessing Amazon DynamoDB

You can access Amazon DynamoDB by using three different methods: -

  • Console (https://console.aws.amazon.com/dynamodb/home)
  • Command Line Interface (Simply open your command prompt and type the related commands to access the table)
  • API (You can use AWS SDK’s to access DynamoDB which supports a variety of languages like Java, Javascript, Python, .Net, PHP, etc.)

Features of Amazon DynamoDB 

  • Using DynamoDB, developers can easily develop scalable cloud-based applications
  • AWS can easily achieve data retrieval in the single-digit milliseconds
  • DevOps need not worry about managing high availability and durability of data because DynamoDB automatically replicates it synchronously across multiple AWS Availability Zones (AZs)
  • DynamoDB can be provisioned according to the number of write units and several read units allocated
  • The user’s database table always remain available based on provisioned throughput requirements like read-write units per second
  • DynamoDB utilizes JSON as a transport protocol
  • Hashkeys are used for the data partitioning in DynamoDB
  • NoSQL and Big Data are the technologies that work together because they both share the same allocated and scalable side-to-side structure of the database

Amazon DynamoDB API

DynamoAPI offers a wide set of actions which require permissions. To set permissions, you have to establish the actions permitted, resources permitted, and conditions of each.

For example − dynamodb:CreateTable

You can also employ condition keys to filter permissions.

API Operation Necessary Permission
BatchGetItem dynamodb:BatchGetItem
BatchWriteItem dynamodb:BatchWriteItem
CreateTable dynamodb:CreateTable
DeleteItem dynamodb:DeleteItem
DeleteTable dynamodb:DeleteTable
DescribeLimits dynamodb:DescribeLimits
DescribeReservedCapacity dynamodb:DescribeReservedCapacity
DescribeReservedCapacityOfferings dynamodb:DescribeReservedCapacityOfferings
DescribeStream dynamodb:DescribeStream
DescribeTable dynamodb:DescribeTable
GetItem dynamodb:GetItem
GetRecords dynamodb:GetRecords
GetShardIterator dynamodb:GetShardIterator
ListStreams dynamodb:ListStreams
ListTables dynamodb:ListTables
PurchaseReservedCapacityOfferings dynamodb:PurchaseReservedCapacityOfferings
PutItem dynamodb:PutItem
Query dynamodb:Query
Scan dynamodb:Scan
UpdateItem dynamodb:UpdateItem
UpdateTable dynamodb:UpdateTable


In the following table, you can view the resources associated with each permitted API action −

API Operation Resource
BatchGetItem arn:aws:dynamodb:region:account-id:table/table-name
BatchWriteItem arn:aws:dynamodb:region:account-id:table/table-name
CreateTable arn:aws:dynamodb:region:account-id:table/table-name
DeleteItem arn:aws:dynamodb:region:account-id:table/table-name
DeleteTable arn:aws:dynamodb:region:account-id:table/table-name
DescribeLimits arn:aws:dynamodb:region:account-id:*
DescribeReservedCapacity arn:aws:dynamodb:region:account-id:*
DescribeReservedCapacityOfferings arn:aws:dynamodb:region:account-id:*
DescribeStream arn:aws:dynamodb:region:account-id:table/table-name/stream/stream-label
DescribeTable arn:aws:dynamodb:region:account-id:table/table-name
GetItem arn:aws:dynamodb:region:account-id:table/table-name
GetRecords arn:aws:dynamodb:region:account-id:table/table-name/stream/stream-label
GetShardIterator arn:aws:dynamodb:region:account-id:table/table-name/stream/stream-label
ListStreams arn:aws:dynamodb:region:account-id:table/table-name/stream/*
ListTables *
PurchaseReservedCapacityOfferings arn:aws:dynamodb:region:account-id:*
PutItem arn:aws:dynamodb:region:account-id:table/table-name
Query arn:aws:dynamodb:region:account-id:table/table-name arn:aws:dynamodb:region:account-id:table/table-name/index/index-name
Scan arn:aws:dynamodb:region:account-id:table/table-name arn:aws:dynamodb:region:account-id:table/table-name/index/index-name
UpdateItem arn:aws:dynamodb:region:account-id:table/table-name
UpdateTable arn:aws:dynamodb:region:account-id:table/table-name

As an instance, the classification of DynamoDB is as follows: -

  • Control Plane (It is responsible for creating and managing DynamoDB table)
    • Create Table
    • Describe Table
    • List Table
    • Delete Table 
  • Data Plane (It consists of ‘CRUD’ operation, i.e. Create, Read, Update & Delete)
    • Creating Data
      • PutItem
      • BatchWriteItem
    • Reading Data
      • GetItem
      • BatchGetItem
      • Query
      • Scan
    • Updating Data
      • UpdateItem
    • Deleting Data
      • DeleteItem
      • BatchWriteItem 
  • DynamoDB Stream
    • ListStream
    • DescribeStream
    • GetSharedIterator
    • GetRecords

Installing DynamoDB on your computer (Local)

You can install a downloadable version of Amazon DynamoDB into your system which is provided in an executable .jar file. The downloaded file can be installed and run on Windows, Linux, MacOS, and the systems that run on Java.

You need to have Java Runtime Environment (JRE) version 6.x or above installed on your system. The application does not run on earlier versions of JRE.

Following steps will allow you to set up and run DynamoDB on your computer system: -

  1. Download DynamoDB for free on AWS Amazon’s official website.
  2. To start DynamoDB on your computer, open a command prompt window, navigate to the directory where you extracted DynamoDBLocal.jar, and enter the following command. java -Djava.library.path=./DynamoDBLocal_lib -jar DynamoDBLocal.jar -sharedDb
  3. If you're using Windows PowerShell, be sure to enclose the parameter name or the entire name and value like this: java -D"java.library.path=./DynamoDBLocal_lib" -jar DynamoDBLocal.jarDynamoDB processes incoming requests until you stop it. To stop DynamoDB, press Ctrl+C at the command prompt. DynamoDB uses port 8000 by default. If port 8000 is unavailable, this command throws an exception. For a complete list of DynamoDB runtime options, including -port, enter this command. java -Djava.library.path=./DynamoDBLocal_lib -jar DynamoDBLocal.jar -help
  4. Before you can access DynamoDB programmatically or through the AWS Command Line Interface (AWS CLI), you must configure your credentials to enable authorization for your applications. Downloadable DynamoDB requires any credentials to work, as shown in the following example. AWS Access Key ID: "fakeMyKeyId" AWS Secret Access Key: "fakeSecretAccessKey" You can use the aws configure command of the AWS CLI to set up credentials.
  5. You can start writing applications. To access DynamoDB running locally, use the --endpoint-url parameter. For example, use the following command to list DynamoDB tables. aws dynamodb list-tables --endpoint-url http://localhost:8000

Setting up DynamoDB (Web Services)

If you plan to interact with DynamoDB only through the AWS Management Console, you don't need an AWS access key, and you can skip ahead to Using the Console.

To use the Amazon DynamoDB web services, you need to perform the following steps: -

  1. Sign up for AWS.
  2. Get an AWS access key (used to access DynamoDB programmatically).
  3. Configure your credentials (used to access DynamoDB programmatically).

Signing Up for AWS

To use the DynamoDB service, you must have an AWS account. If you don't already have an account, you are prompted to create one when you sign up. You're not charged for any AWS services that you sign up for unless you use them.

Read: How to Create Amazon Chatbot & Integrate with Facebook?

To sign up for AWS

  1. Open https://portal.aws.amazon.com/billing/signup.
  2. Follow the online instructions.

Part of the sign-up procedure involves receiving a phone call and entering a verification code on the phone keypad.

Getting an AWS Access Key

Before you can access DynamoDB programmatically or through the AWS Command Line Interface (AWS CLI), you must have an AWS access key. You don't need an access key if you plan to use the DynamoDB console only.

Access keys consist of an access key ID and secret access key, which are used to sign programmatic requests that you make to AWS. If you don't have access keys, you can create them from the AWS Management Console. As a best practice, do not use the AWS account root user access keys for any task where it's not required. Instead, create a new administrator IAM user with access keys for yourself.

The only time that you can view or download the secret access key is when you create the keys. You cannot recover them later. However, you can create new access keys at any time. You must also have permissions to perform the required IAM actions.

To create access keys for an IAM user

  1. Sign in to the AWS Management Console and open the IAM console at https://console.aws.amazon.com/iam/.
  2. In the navigation pane, choose Users.
  3. Choose the name of the user whose access keys you want to create, and then choose the Security credentials tab.
  4. In the Access keys section, choose Create access key.
  5. To view the new access key pair, choose Show. You will not have access to the secret access key again after this dialog box closes. Your credentials will look something like this:
    • Secret access key: wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
  6. To download the key pair, choose Download .csv file. Save the keys in a secure location. You will not have access to the secret access key again after this dialog box closes. Keep the keys confidential in order to protect your AWS account and never email them. Do not share them outside your organization, even if an inquiry appears to come from AWS or Amazon.com. No one who legitimately represents Amazon will ever ask you for your secret key.
  7. After you download the .csv file, choose Close. When you create an access key, the key pair is active by default, and you can use the pair right away.

Configuring Your Credentials

Before you can access DynamoDB programmatically or through the AWS CLI, you should configure your credentials to enable authorization for your applications.

There are several ways to do this. For example, you can manually create the credentials file to store your access key ID and secret access key. You also can use the AWS configure command of the AWS CLI to create the file automatically. Alternatively, you can use environment variables.

Terminologies Associated with DynamoDB 

  • Tables–DynamoDB stores data in tables which is similar to the concept of other databases. A table is a collection of data.
  • Items– Every table contains zero or more items. An item is a group of attributes that is uniquely identifiable among all of the other items. Items in DynamoDB are similar in many ways to rows, records, or tuples in other database systems. In DynamoDB, there is no limit to the number of items you can store in a table.
  • Attributes– Each item is formulated of one or more attributes. An attribute is a fundamental data element, something that does not need to be broken down any further.

The following diagram shows a table named People with some example items and attributes-

Terminologies Associated with DynamoDB 

Note the following about the People table:

  • Each item in the table has a unique identifier, or primary key, that distinguishes the item from all of the others in the table. In the Peopletable, the primary key consists of one attribute (PersonID).
  • Other than the primary key, the Peopletable is schema-less, which means that neither the attributes nor their data types need to be defined beforehand. Each item can have its own distinct attributes.
  • Most of the attributes are scalar, which means that they can have only one value. Strings and numbers are common examples of scalars.
  • Some of the items have a nested attribute (Address). DynamoDB supports nested attributes up to 32 levels deep.

Amazon DynamoDB Primary Key

When you create a table, in addition to the table name, you have to specify the primary key of the table. The primary key uniquely identifies each item in the table, so that no two items can have the same key.

DynamoDB supports two different kinds of primary keys:

  • Partition key– A simple primary key that is composed of one attribute known as the partition key. DynamoDB uses the partition key's value as input to an internal hash function. The output from the hash function determines the partition (physical storage internal to DynamoDB) in which the item will be stored. An important rule to implement Partition key is that A table that has only a partition key, no two items can have the same partition key value. The People table described in Tables, Items, and Attributes is an example of a table with a simple primary key (PersonID). You can access any item in the People table directly by providing the PersonId value for that item.
  • Partition key and sort key– It is referred to as a composite primary key, this type of key is composed of two attributes. The first attribute is the partition key, and the second attribute is the sort key. DynamoDB uses the partition key value as input to an internal hash function. The output from the hash function determines the partition (physical storage internal to DynamoDB) in which the item will be stored. All items with the same partition key value are stored together, in sorted order by sort key value.

Amazon DynamoDB Secondary Indexes

You can create one or more secondary indexes on a table. A secondary index lets you query the data in the table using an alternate key, in addition to queries against the primary key. DynamoDB doesn't require that you use indexes, but they give your applications more flexibility when querying your data. After you create a secondary index on a table, you can read data from the index in much the same way as you do from the table.

DynamoDB supports two kinds of indexes:

  • Global secondary index – An index with a partition key and sort key that can be different from those on the table.
  • Local secondary index – An index that has the same partition key as the table, but a different sort key.

Each table in DynamoDB has a limit of 20 global secondary indexes (default limit) and five local secondary indexes per table.

Amazon DynamoDB Streams

DynamoDB Streams is an optional feature that captures data modification events in DynamoDB tables. The data about these events appear in the stream in near-real-time, and in the order that the events occurred.

Each stream record also contains the name of the table, the event timestamp, and other metadata. Stream records have a lifetime of 24 hours; after that, they are automatically removed from the stream.

Read: AWS, Linode & DigitalOcean Compared- All you should know

You can use DynamoDB Streams together with AWS Lambda to create a trigger—code that executes automatically whenever an event of interest appears in a stream. For example, consider a Customers table that contains customer information for a company. Assume that you want to send a "welcome" email to each new customer. You can allow a stream on that table, and then associate the stream with a Lambda function. The Lambda function will execute whenever a new stream record appears, but only process new items added to the Customers table. For any item that has an EmailAddress attribute, the Lambda function would invoke Amazon Simple Email Service (Amazon SES) to send an email to that address.

Amazon DynamoDB Streams

In the above example, the last customer, Craig Roe, will not receive an email because he doesn't have an Email Address.

How does DynamoDB work?

A DynamoDB database can be broken down into three theorems:

  1. Tables: A collection of things that you want to store together
  2. Items: An item is just like a row in a normal database
  3. Attributes: A column or field in a normal databaseHow does DynamoDB work?

A DynamoDB table must have a primary key. There are two possible types to choose from:

  1. Partition Key — Single Attribute —which will just be a field in your data source that uniquely represents the row (e.g., an auto-generated, unique product ID).
  2. Partition Key & Sort Key — Composite Key — which will be a combo of two attributes that will uniquely identify the row, and how the data should naturally be sorted (e.g., Unique product ID and purchase date timestamp)

Your DynamoDB partition key must be unique and sparse. As this key is hashed internally and used to distribute that data for storage. This is a similar technique to Redshift and HBase that prevents hot-spotting of data.

If using a composite key, then two items can have the same Partition Key, but the Sort Key must be unique. This will mean all items with the same Partition key will be stored together but sorted in ascending order using the Sort Key.

How to Create a table in DynamoDB

Step 1: Navigate to the DynamoDB section in AWS.  Select “Create Table“.  

How to Create a table in DynamoDB

Step 2: Fill in with the necessary details and click on “Create.“

How to Create a table in DynamoDB

Step 3: You can view your table being created. Click on “Overview” to understand your table, click on “Items” to edit, insert and query on the table. There are many more options you can use to understand your table better.

How to Create a table in DynamoDB

How to Insert a table in DynamoDB? 

Step 1: Navigate to “Items” and click on “Create item.“ 

How to Insert a table in DynamoDB? 

Step 2: It will open a JSON file where you can add different items. Click on the “+” symbol and select “Append” and select what type of data you want to enter. 

Read: Amazon Redshift vs Amazon RDS vs DynamoDB vs SimpleDB

How to Insert a table in DynamoDB? 

Step 3: This is what it looks like after adding multiple columns to your table. Click on “Save“. 

How to Insert a table in DynamoDB? 

Step 4: Since it is a NoSQL architecture, you can play around with the columns you add to the table. E.g., “Position.“ 

How to Insert a table in DynamoDB? 

Step 5: This is how your table will look like once you have inserted the data. 

How to Insert a table in DynamoDB? 

How to apply Queries on a table in DynamoDB? 

Step 1: Here, you can frame your query and click on “Start Search” to get the desired result.

E.g., I am searching for all the mobile numbers that are greater than or equals to “1234“. 

How to Insert a table in DynamoDB? 

Step 2: Here, I am searching for the record which has EmpId as “ED4“.

How to Insert a table in DynamoDB? 

The above steps will allow you to create, insert, and querying a table in DynamoDB.


  • DynamoDB is a fully managed NoSQL database service provided by Amazon
  • A table is a visualized view of data
  • An item is said to be a set of attributes in a table
  • An attribute is a single field that is linked to an item
  • A primary key is a unique differentiation of data items
  • DynamoDB is a database tool which requires API to interact with an application

    Janbask Training

    A dynamic, highly professional, and a global online training course provider committed to propelling the next generation of technology learners with a whole new way of training experience.


Trending Courses


  • AWS & Fundamentals of Linux
  • Amazon Simple Storage Service
  • Elastic Compute Cloud
  • Databases Overview & Amazon Route 53

Upcoming Class

6 days 17 Apr 2021


  • Intro to DevOps
  • GIT and Maven
  • Jenkins & Ansible
  • Docker and Cloud Computing

Upcoming Class

6 days 17 Apr 2021

Data Science

  • Data Science Introduction
  • Hadoop and Spark Overview
  • Python & Intro to R Programming
  • Machine Learning

Upcoming Class

5 days 16 Apr 2021


  • Architecture, HDFS & MapReduce
  • Unix Shell & Apache Pig Installation
  • HIVE Installation & User-Defined Functions
  • SQOOP & Hbase Installation

Upcoming Class

5 days 16 Apr 2021


  • Salesforce Configuration Introduction
  • Security & Automation Process
  • Sales & Service Cloud
  • Apex Programming, SOQL & SOSL

Upcoming Class

12 days 23 Apr 2021


  • Introduction and Software Testing
  • Software Test Life Cycle
  • Automation Testing and API Testing
  • Selenium framework development using Testing

Upcoming Class

5 days 16 Apr 2021

Business Analyst

  • BA & Stakeholders Overview
  • BPMN, Requirement Elicitation
  • BA Tools & Design Documents
  • Enterprise Analysis, Agile & Scrum

Upcoming Class

6 days 17 Apr 2021

MS SQL Server

  • Introduction & Database Query
  • Programming, Indexes & System Functions
  • SSIS Package Development Procedures
  • SSRS Report Design

Upcoming Class

5 days 16 Apr 2021


  • Features of Python
  • Python Editors and IDEs
  • Data types and Variables
  • Python File Operation

Upcoming Class

12 days 23 Apr 2021

Artificial Intelligence

  • Components of AI
  • Categories of Machine Learning
  • Recurrent Neural Networks
  • Recurrent Neural Networks

Upcoming Class

19 days 30 Apr 2021

Machine Learning

  • Introduction to Machine Learning & Python
  • Machine Learning: Supervised Learning
  • Machine Learning: Unsupervised Learning

Upcoming Class

12 days 23 Apr 2021


  • Introduction to Tableau Desktop
  • Data Transformation Methods
  • Configuring tableau server
  • Integration with R & Hadoop

Upcoming Class

8 days 19 Apr 2021

Search Posts


Receive Latest Materials and Offers on AWS Course