DynamoDB vs Amazon Aurora — The Ultimate Comparison
Written by Kavindu Gunathilake
Published on November 23rd, 2021
Time to 10x your DynamoDB productivity with Dynobase [learn more]
AWS provides a wide range of cloud-based database systems for developers. Some of them are Relational, and others are NoSQL.
This article shows a comparison between two popular database services, DynamoDB and Aurora, both Serverless and fully managed by AWS.
Shared Attributes for DynamoDB and Aurora
For fully-managed databases, choosing DynamoDB or Aurora, you can focus your full attention on using the database rather than doing database administration. Both the databases fulfill high scalability requirements, and the capacity can automatically grow as needed.
And, the most significant difference among them is that DynamoDB is a NoSQL database while Aurora is a relational database.
Besides, if we consider massive amounts of data, DynamoDB is the winner, supporting petabytes of data and seamlessly scales up or down. However, Aurora cluster volume can also grow up to 128 Terabytes, but it may take up to 15 minutes when changing its size.
Latency and Performance
First, let’s compare the database access latency and query performance in detail.
DynamoDB can create database tables that can store data and serve any level of on-demand traffic. In addition, the high IO performance of SSDs provides less latency and response time for storing and reading data at any scale.
This server instance supports the computational resources needed for database operations. Regardless of the size of your table, it maintains low latency (millisecond latency) behind this practice. In addition, maintaining a better table layout, using the keys and indexes effectively for queries, and streamlining the database workload, optimizes DynamoDB’s performance.
DynamoDB handles up to 10 trillion requests per day and more than 20 million requests per second. I hope you can simply imagine how scalable it is by looking at these numbers.
Amazon Aurora is a MySQL and PostgreSQL-compatible relational database solution. It has a five-time throughput rate as standard MySQL output and a three-time throughput rate as standard PostgreSQL output. According to AWS, the Storage service design for Aurora makes this possible.
One of the basic design principles for this storage service is to minimize the latency in writing in the foreground. This design takes the majority of storage processing to the background. As a result, it improves throughput and makes it a high-performing cloud-native relational database in AWS.
Encryption at Rest
Both DynamoDB and Aurora support encryption at rest using encryption keys stored in AWS KMS (Key Management Service). We can use AWS KMS to create, store, and manage their encryption keys.
On the other hand, Amazon DynamoDB users have three options to encrypt the table with the use of AWS KMS.
- The key of DynamoDB is encrypted by default, and it is at zero cost (AWS-owned key).
- KMS will secure the keys stored in your account, and a fee will apply (AWS-managed key).
- KMS Customer Management Keys (CMK) gives users complete control over KMS keys and charges a price (Customer-managed key).
Amazon Aurora has AWS-managed keys and customer-managed keys. Customer managed or customer master keys will be known as the CMK feature in AWS KMS.
Learn more about DynamoDB Security here
DynamoDB has IAM users and roles support with fine-grained policies to limit the database creation and query permissions. A similar permission scheme also exists for Amazon Aurora.
However, Aurora also provides MySQL and PostgreSQL-compatible connection interfaces to connect to the database.
Besides, DynamoDB is a regional service that stays outside the VPC boundary. But Aurora DB clusters must be created in a VPC clearly defining its network boundary. And, you can use the VPC security group to control which devices and Amazon EC2 instances can connect to the database instance.
Other Features Comparison
Durability and Availability
Every single piece of data in DynamoDB is replicated to the multiple physical nodes. Amazon has positioned these physical nodes in several zones for each geographical region (aka availability zones) to maintain high durability and availability even in a major disaster such as a fire or significant power outage. If one copy is down, others will support to continue the operations. Also, SSDs offer built-in high availability and data durability.
Amazon Aurora supports available zones. With single-master replication, users can create 15 read-only replicas after completing the primary instance. When a problem occurs with the primary model, one of these read-only instances will be the primary instance (failover). This mechanism will happen automatically when necessary.
Backups and Restore
DynamoDB has an on-demand backup and PITR (Point-in-time backups) making it possible to go to any previous database state. DynamoDB can back up any amount of data, and availability or performance will make no impact. The backup process takes little time, and the user does not have to worry about backup schedules and background running processes. AWS supports backup recovery from a single API call and costs just one click.
Similar to DynamoDB, the Amazon Aurora backup process was built without performance interruption or database service interruption. Amazon backups are stored in an S3 bucket. If we don’t specify a backup window, Aurora will automatically assign a 30-minute backup by default. We can also recover data by creating a new Aurora DB cluster from Aurora’s backup data.
When to Use Which
Use cases for DynamoDB
When an operating database system is required for a small startup, looking at a relational database system can be complicated and expensive. Besides, finding and allocating technical resources to manage the database is costly for the business.
Therefore if you are using AWS already, DynamoDB is the best NoSQL data model solution for this. Furthermore, with its ability to scale automatically without interruption, we don’t need to waste time manually adjusting the space. To get a better understanding of it, you can refer to the Duolingo Case Study.
As mentioned above, DynamoDB’s scale performance is phenomenal, and it is fast in both reading and writing. Therefore, a business that needs a quick read and writes data transaction system should always go with DynamoDB.
Use cases for Aurora
There are situations when customers have to stay with relational databases to achieve business objectives. DynamoDB or other NoSQL options are not the solutions when organizations need to store predictable, structured data. In that case, Amazon Aurora is the best solution with high scalability and best performances.
Enterprise businesses have to use relational databases according to their business and technical architecture most of the time. However, companies using relational databases can migrate to AWS Aurora with fewer changes to experience high performance and scalability.
AWS will oversee automated clustering, redesign, and storage. It is billed for storage consumption and consuming IO. AWS charges in GB-monthly increments for database storage consumption, and IOs consumed are billed in per million request increments. This link will provide simplified examples of how it calculates.
Features like Global Database, Backtrack, Snapshot Export, and data transfer from Aurora are charged separately. In addition, there are two different pricing charts for MySQL-compatible and the PostgreSQL-compatible editions of Amazon Aurora.
DynamoDB contains many optional features other than reading, writing, and storing data. Charges are applicable for these services. The main thing to highlight is choosing the right pricing model based on your preferences by choosing either on-demand or provision capacity as required.
On-demand capacity mode — DynamoDB adapts your workload up or down when necessary, so you don’t need to specify the amount of reading and write throughput you expect your app to run. The read and write actions price is dynamic and based on the received traffic to the application.
Provisioned capacity mode — In here, you must specify the number of reads and write requests required for your application. Then, read, write prices will be calculated according to them. The first 25 GB of storage usage fall under the AWS free tier for on-demand capacity and provisioned capacity modes.
Is DynamoDB more expensive than Aurora?
When considering the storage rate and IO rate, it will depend on the size of your dataset. DynamoDB provides a free tier for the first 25 GB of usage. After that, they will charge $0.25 per GB-month. Compared to DynamoDB, Aurora will charge slightly lower price rates for storage and IOs. But it will not give the benefits that come with the DynamoDB free tier.
Data transfer is zero cost for both DynamoDB and Aurora up to 1GB.
DynamoDB may be more expensive for a large-scale organization than Aurora, especially if your application has a higher number of query requirements. But for a startup or small organization, DynamoDB would be the best cost-effective solution.
© 2022 Dynobase