Analytics Vidhya
Published in

Analytics Vidhya

AWS’s DynamoDB and How does it work?

Image by WilliamsCreativity from Pixabay

What is DynamoDB and what does it offer ?

DynamoDB is Amazon’s fully managed NoSQL key-value serverless database as a service. Among many benefits that it provides over other databases, the ability of the service to scale up and down as required along with no explicit requirement to provision hardware from the user’s side is one of the most amazing qualities of DynamoDB.

  • delivers single digit millisecond performance at scale.
  • Is available in multiple AWS availability zones within the region through automatic replication.
  • Provides built-in security, backup and restore.
  • Is highly durable.
  • Is capable of handling 10 trillion request per day and 20 million requests per second.
  • Capable of providing low latency data access at any scale.
  • Offers encryption at transit as well as at rest.
  • Used by many world known organization such as lyft, Airbnb, Samsung, Toyota, Nike, Netflix and many more as database for applications such as Web, mobile, IoT, gaming and many more.

What is Key-Value database?

If you are a programmer, you must be well aware of the key-value pair concept. This concept is heavily used in almost every programming language. For example, JavaScript objects store data in key-value pairs. Implementation of JavaScript objects utilizing the Key-Value concept is shown below.

let myObject = {
name: 'Prashant',
platform: 'Medium'
};
Let item = {
username: 'Prashant',
password: 'password',
email: 'email@email.com',
mobile: 0000000000,
gender: 'male',
age: 23
}

Storing and retrieving data

You must be wondering how would you go and retrieve this information from the table. If you are familiar with SQL database, then you know retrieval is performed using a primary key or any other unique key if a particular record needs to be retrieved, and SELECT statement if a group of records needs to be retrieved. DynamoDB uses something different than this but not entirely. When creating a table, DynamoDB requires you to select at least one attribute as a primary key.

# item 1
[
"roomId" : 'xyz',
"messageId" : '123',
"from" : "userA",
"date" : "20 Feb 2021"
]
#item 2
[
"roomId" : 'xyz',
"messageId" : '124',
"from" : "userB",
"date" : "20 Feb 2021"
]
#item 3
[
"roomId" : 'xyz',
"messageId" : '125',
"from" : "userC",
"date" : "20 Feb 2021"
]

DynamoDB as a managed Database as a Service

This quality encapsulates all the other qualities of DynamoDB but also includes lots of concepts that will not be covered in this blog since they are more of a general database concept rather than something specific to DynamoDB and have lots of specific resources out there which can explain these concepts in much detail. Having said that, let’s continue.

  • Automatic Scalability
    DynamoDB automatically scales up and down your database to maintain the performance of the service. DynamoDB asks you to select one of the two options for service capacity while creating tables. You can either choose the on-demand option which will scale capacity up or down from the very start based on the throughput or provision the minimum capacity at the start and select auto-scaling to scale up and down the capacity from that minimum capacity. In the latter case, the minimum capacity that you provision will always be allocated and running even if it’s idle. Auto-Scaling feature of DynamoDB scales without affecting the performance and with no downtime.
  • Availability and Fault Tolerance
    Data is replicated across multiple availability zones to provide high availability and durability. This also helps to spread traffic over the multiple servers ultimately maintaining consistent and single-digit millisecond performance at any scale.
  • Encryption at transit and at rest
    DynamoDB not only encrypts your data while in transit but also while it’s stored and resting on physical hardware which helps to reduce complexity as well as computational consumption at your end.
  • On-demand Backup and Point in Time recoveryDynamoDB offers on-demand full backup of full tables for long-term retention. This capability allows users to create a backup of terabytes of data without having any impact on performance and with negligible downtime. These backups are encrypted, cataloged, can be retrieved easily, and are not deleted until explicitly told to. Point in time recovery if enabled, maintains regular incremental backups of DynamoDB tables for the last 35 days and can be recovered to any point in time during the last 35days. This helps to protect the data from accidental delete and write operations.

Additional features and capabilities of DynamoDB

  1. It provide identity and access control.
  2. It supports ACID transactions.
  3. It provide Time to Live which automatically removes item from table automatically when it is expired to help to reduce cost and optimize storage usage.
  4. It provides ability to create global tables to keep tables and data in sync with multiple regions.
  5. and all the other benefits that comes with being an AWS product i.e. full integration with other AWS products and services.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Prashant Sihag

Software Developer. Technology Enthusiast. Learning and explaining technologies in simpler ways.