Amazon RDS Vs DynamoDB: Which Database Will Cost You Less?
Exploring the key differences in costs between the two databases
When comparing Amazon RDS MySQL vs Amazon DynamoDB for querying a table with 1 million items, the differences in costs depends on factors like query complexity, read patterns, and indexing.
Here is a brief but detailed breakdown.
Amazon RDS MySQL Costs
Instance Costs: RDS is billed based on the instance size and storage. A typical db.t3.medium costs $0.0416/hour ($30/month if running 24/7).
Storage Costs: $0.115 per GB/month (10 GB = $1.15/month).
IO Costs (if using IOPS-based storage): $0.10 per million I/O requests.
Query Costs: There is no direct cost per query, but queries consume CPU, memory, and disk IO.
Total Estimate:
If running an on-demand RDS instance 24/7: ~$31/month
If using Aurora Serverless: Starts at ~$4/month (but scales based on usage).
Amazon DynamoDB Costs
Read Costs:
On-Demand Mode: $1.25 per million reads.
Provisioned Mode: ~$0.00013 per read request (strongly consistent).
Storage Costs: $0.25 per GB/month.
Indexes: GSI costs extra ($0.25 per GB + read/write ops).
Query Costs:
Queries typically cost 1 read per 4KB item, so fetching a 1KB item costs 1 read.
Scanning the entire table would cost 1 million reads = $1.25 (on-demand).
Cost Comparison Summary
The Takeaways:
If you query a few times per second, DynamoDB is cheaper.
If you run complex queries on large datasets, RDS may be more cost-effective.
For full table scans, RDS doesn’t charge per query, while DynamoDB can get expensive fast.
Which One Should You Use?
Use DynamoDB if:
You need low-latency, high-scale queries.
You mainly do single-item lookups or indexed range queries.
You don’t want to manage servers.
Your access patterns are predictable.
Use RDS if:
You need complex filtering, aggregations, and joins.
Your queries often involve ad-hoc conditions.
You want to avoid DynamoDB’s per-query costs for large scans.
Your dataset doesn’t grow exponentially.
A tip to save costs on both databases
For both DynamoDB and RDS instances, purchasing reserved instances will save you considerably in yearly costs.
DynamoDB reservered capacity:
RDS Reserved instance:
https://aws.amazon.com/rds/reserved-instances/
Summary
Ultimately, the choice between Amazon RDS and DynamoDB comes down to your workload patterns and cost priorities.
DynamoDB is more cost efficient and ideal for ephemeral transactions or irregular patterns.
RDS MySQL will come out cheaper if you’re data transactions are longer-running and consistent.
As always the choice should be made based on your application’s use cases.
👋 My name is Uriel Bitton and I’m committed to helping you master Serverless, Cloud Computing, and AWS.
🚀 If you want to learn how to build serverless, scalable, and resilient applications, you can also follow me on Linkedin for valuable daily posts.
Thanks for reading and see you in the next one!