With the launch of DocumentDB , AWS has pinned two document-centric database services to its catalog. DocumentDB now pairs with DynamoDB, a key / value datastore that also supports document type data – and another NoSQL service .
Even though these two products belong to the same category, they differ in many ways. Let’s review these differences and consider the use cases for each.
How to use document-oriented databases
An important feature of document databases is that they impose no restrictions on the structure of the data. Each document, which is compared to a line in a traditional relational database , can have its own data structure. We can store several documents in the same database while maintaining flexibility with the data they contain.
To launch a cluster, developers must perform several configurations (usually tedious) such as replication and data backup, without disrupting their applications. DocumentDB aims to remove this constraint.
To create a DocumentDB cluster, you need to select several parameters, such as the database instance class, the number of nodes, the Virtual Private Cloud (VPC), and the authentication method. Once the instances are launched, DocumentDB manages the servers as well as several operations. For example, the service can create backups , update engine versions, or increase disk storage capacity. For their part, administrators have the opportunity to optimize the cluster’s capacity and to choose the number of nodes and the instance class.
DocumentDB is compatible with MongoDB , a database, too, of document type very popular among developers and in open source. Thus, applications using MongoDB can exploit DocumentDB without any modification – provided the API versions are compatible.
With DynamoDB , you do not need to configure the infrastructure. Administrators create a ready-to-use DynamoDB table and configure read / write settings. The data is automatically replicated to the Availability Zones and DynamoDB automatically scales on demand.
Like DocumentDB, data in DynamoDB does not have to follow a particular schema. Users can configure additional features, such as Auto Scaling, Global Tables, DynamoDB Accelerator, Point in Time Recovery, Encryption, and VPC.
DynamoDB vs DocumentDB
These AWS databases have some similarities. Both provide tools for migrating data to AWS through the AWS Database Migration Service. Both also offer security features, with inactive encryption via the AWS Key Management Service . They also support auditing capabilities with CloudTrail and VPC flow management for API calls, as well as CloudFormation.
However, it is essential to evaluate the constraints of an application before choosing the right base. DynamoDB is ideally suited for applications that access data based on unique keys, as well as in pure key / value cases. Queries or scans are possible, but they can become complex and difficult to scale.
DocumentDB provides more flexible indexing options, with index updates after table creation – making it easier to query data.
The cost structure of these two AWS databases is also different. DynamoDB can be handled with virtually no initial cost. The main unit of DynamoDB cost is read / write capacity units. The service supports on-demand pricing for these units, as well as reserved-type pricing. Users can manage capacity in small increments of less than $ 1 per month. The first 25GB of storage is free. After that, the cost is $ 0.25 per GB per month. The backup costs $ 0.20 per GB per month, and the cost of restoration is $ 0.15 per GB.
For their part, DocumentDB users pay per node or per EC2 instance. The smallest cost units are r4.large or r5.large instances, which can reach about $ 200 per month, even if they are billed by the hour. DocumentDB will be able to support smaller instances in the future, but to date only support for extended instances is available.