DynamoDB is managed NoSQL database service provided by Amazon Web Services (AWS). It is a fast, flexible and  consistent database solution for modern large-scale applications.

We can scale from 10 to 1000 transactions per second (tps) in couple of seconds. Since it is a managed service, we don’t need to worry about the underlying hardware, servers or operating system. Data stored in the DynamoDB is  copied across multiple Availability Zones so by default it provides protection from data loss.

DynamoDB organizes data as tables and each table contains several items (rows) and each item has Keys and Attributes (columns).

Tables - When we create the table we specify Partition Key and an optional Sort Key, we can not change these later but rest of the attributes (columns) of item (row) can be changed. Also each item can have different set of attributes.

Items - A DynamoDB item is nothing but a row in the table. We can change any attribute of an item except its keys: partition key or sort key, these keys are an identification for an item; if we have to change these keys, then the only option is to delete an item and create it again.

Data types - DynamoDB supports different data types for attributes of an item

Scalar Types : Number, String, Binary, Boolean and Null
Document Types : List and Map
Set Types : Number Set, String Set, and Binary Set.

Partition key - This key is mandatory for the DynamoDB table and item. DynamoDB partitions the items using this key.

Sort Key - This key can be used in conjunction with the Partition key but it is not mandatory. This is useful while querying the data relating a Partition key

Features

Encryption At Rest - DynamoDB has provides encryption at rest feature for making data more secure from an unauthorized access. DynamoDB encryption is a server side encryption and it is transparent to the user so we don’t have to change the application’s code. Once encryption is enabled on the table, all the data related to that table will be encrypted.

Scalability - Today’s web-based applications often encounter database scaling challenges when faced with growth in users, traffic, and data. To address the scalability issues of database, AWS offers DynamoDB which is a fully managed NoSQL database service designed for fast performance at any scale.

Data Partition and Replication - DynamoDB stores data in partitions. A partition is an allocation of storage for a table in solid-state drives (SSDs). The partitions gets automatically replicated across multiple AZs within an AWS Region. These partitions are self-management by DynamoDB and are transparent to the users.

Even though DynamoDB is a NoSQL database system, it has significant differences when compared to other NoSQL database systems like MongoDB or Apache CouchDB.

Comparison with other relational databases

  1. Composite Primary Key -
    Unlike relational databases, the composite primary key for DynamoDB is defined as a combination of a partition key and a sort key. In DynamoDB, we cannot define a composite primary key with more than 2 attributes.
  2. Data Can be Queried Only with Keys and Indexes -
    In SQL Databases we can use any column to select data, and indexes make the selection operation even faster. In DynamoDB however, we can only use the primary key or composite primary to select data. Here, we cannot use the sort key alone for searching.
    Scan operation is provided if you want to search with an attribute other than the primary key.
  3. Limited query capability from AWS web console -
    The AWS console can be used to view table data. But console provides very limited functionality to query or scan tables. Also we cannot insert/update multiple data in one operation. Also, the local client cannot be connected to a table hosted in AWS.  It works only with a locally running DynamoDB server.