If you are looking for some easy resources to get started with the concepts of Amazon DynamoDB, then you are at the right place.
In this blog, we’ll discuss about Amazon DynamoDB, its key concepts, terminology, benefits, use cases and also compare it with the Relational Databases.
Amazon DynamoDB is a fully managed NoSQL database that supports key-value and document data models.
With DynamoDB, we can create database tables that can store and retrieve any amount of data and serve any level of request traffic. It automatically manages the data traffic of tables over multiple servers and maintains performance. It also relieves the customers from the burden of operating and scaling a distributed database. Hence, hardware provisioning, setup, configuration, replication, software patching, cluster scaling, etc. is managed by Amazon.
Terminology and Concepts
In DynamoDB, tables, items, and attributes are the core components.
A table is a collection of items, and each item is a collection of attributes.
Amazon DynamoDB stores data in partitions. A partition is an allocation of storage for a table, backed by Solid State Drives(SSDs) and automatically replicated across multiple Availability Zones within an AWS Region. Partition management is handled entirely by DynamoDB.
DynamoDB uses primary keys to uniquely identify each item in a table and secondary indexes to provide more querying flexibility.
DynamoDB supports two different kinds of primary keys:
- Partition key: It is a simple primary key, composed of a single attribute known as the partition key. This is used to uniquely identifies an item in a DynamoDB table. 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.
- Partition key and sort key: This is also 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. All items with the same partition key value are stored together, in sorted order by sort key value.
A secondary index lets you query the data in the table using an alternate key, in addition to queries against the primary key.
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.
Benefits of Using DynamoDB
Amazon DynamoDB provides the following benefits:
- Scalable: Amazon DynamoDB is designed to scale because it provides virtual unlimited storage, users can store infinity amount of data according to their need. So there is no need to worry about predefined limits to the amount of data each table can store. DynamoDB will spread automatically with the amount of data stored as the table grows.
- Fast: It’s fast because it provides high throughput at very low latency. As datasets grow, latencies remain stable due to the distributed nature of DynamoDB’s data placement and request routing algorithms.
- Flexible: It allows creation of dynamic tables, i.e. the table can have any number of attributes, including multi-valued attributes.
- Data Replication– All data items are stored on SSDs and replication is managed internally across multiple availability zones in a region or can be made available across multiple regions.
- Serverless– DynamoDB scales horizontally by expanding a single table over multiple servers.
- Easy Administration– Amazon DynamoDB is a fully managed service, you don’t need to worry about hardware or software provisioning, setup & configuration, software patching, distributed database cluster or partitioning data over multiple instances as you scale
- Cost Effective: Payment is for what we use without any minimum charges. Its pricing structure is simple and easy to calculate. Basically it charges for reading, writing, and storing data along with any optional features you choose to enable in DynamoDB.
- Secure– Amazon DynamoDB encrypts at rest all user data stored in tables, indexes, streams, and backups using encryption keys stored in AWS Key Management Service (AWS KMS). This provides an additional layer of data protection by securing your data from unauthorized access to the underlying storage .
Comparison Between DynamoDB and other Relational Databases
|DynamoDB||Relational Databases(e.g. SQL)|
|Flexible schema||Fixed schema for each table|
|Provide APIs to read and write data||Need to write SQL queries to read and write data.|
|No upper limits on the number of items per table, nor the total size of that table.||Relational databases have maximum sizes for the number and size of files, which imposes upper limits on scalability.|
|Suited for Web-scale applications, including social networks, gaming, media sharing, and IoT.||Suited for Ad hoc queries; data warehousing; OLAP (online analytical processing).|
Use Cases of DynamoDB
Amazon DynamoDB is ideal for systems that require a high speed in data reading and writing.
There could be many instances where we can use DynamoDB. Below are some of them:
- Real-time bidding
- Shopping carts
- High I/O needs
- Unstructured data from mobile applications and gaming software
- Content management
That’s it for now. This was a very beginner-friendly blog and will surely help you get started with the concepts of Amazon DynamoDB. Hope you find it useful and easy to understand.
To read more such blogs on latest technologies, visit Knoldus Blogs