AWS has an entire category for their managed database services, which make creating and running a database on the AWS platform very easy. What are they offering, and is it better than running it yourself on EC2?
You Can Always Use EC2
Many of the databases in this list simply use EC2 under the hood to do all the heavy lifting. If you are fine with handling all of the setup, management, backups, replication, and scaling yourself, then you can use EC2 and install the database software manually. This is a completely viable option, even for large databases.
The benefit of a service like RDS is that the whole process is managed for you, but that does cost extra money. Every database-as-a-service on this list will come at a cost premium compared to the underlying EC2 instance (save for DynamoDB, which doesn’t use servers).
Running on EC2 works particularly well if you are running a small database and want to cut costs, since the pricing for the smaller EC2 instances is quite cheap. Also, if you’ve got an EC2 instance already, and aren’t maxing it out, you can run a database alongside your other programs rather than getting a separate instance for the database.
AWS RDS Hosts Most Relational Databases
AWS RDS is their general purpose managed database service. It runs on EC2, but creation, read replicas, and incremental backups are all fully managed for you. You simply pay for the underlying EC2 instance (at a small premium), plus the EBS storage costs.
Creating a database is simple; from the RDS console, click “Create Database,” and specify the instance type you want. You’ll pay for this instance, plus the storage provisioned. In general, RDS is a bit more expensive than just using the underlying EC2 instance and configuring everything yourself. But, with all the benefits of a having a database as a service, RDS will still be beneficial for some people.
AWS Aurora
Aurora is AWS’s proprietary relational database. It’s MySQL or PostgreSQL compatible, but uses a different underlying engine. It’s selectable as an option when setting up a database in RDS.
AWS claims Aurora is three times faster than PostgreSQL and MySQL, which is quite an improvement, but it isn’t as flashy as it may seem. It’s only faster with high provisioned IOPS (disk speed) on huge database instances, and is much more expensive if you’re really going for speed.
As a general database, Aurora works well, but is a bit more expensive than other RDS offerings like MySQL. There is a serverless option for Aurora though, which seems to cut costs quite a bit, and allows your database to autoscale up and down.
AWS DocumentDB: MongoDB Compatible
DocumentDB is AWS’s replacement for Mongo. It’s not actually Mongo under the hood, but it acts as such and is entirely compatible with existing Mongo drivers. It’s easy to launch from the DocumentDB Console, and can scale to millions of requests per second with up to 15 read replicas.
DocumentDB works similarly to RDS in that you pay for the underlying EC2 instance, though it should be noted that the instance selection is limited to the memory optimized R5 instances, which are not cheap. The cheapest R5 instance is the db.r5.large instance which costs $0.277 per hour, or about $200 per month. This is also a slight cost increase compared to MySQL on RDS, so it definitely comes at a premium compared to traditional MongoDB on EC2.
AWS DynamoDB: Serverless NoSQL Database
DynamoDB is special in that it’s the only database on this list that is entirely serverless. It’s offered as a service like S3, and there’s no instances for you to manage. All of the compute is handled by AWS.
DynamoDB is a key-value and document database, similar to MongoDB. It’s a bit different though, but AWS offers migration tools for transitioning to DynamoDB from MongoDB and MySQL.
You’re charged based on requests and storage, though the list of taxes is a bit long:
$1. 25 per million writes $1. 875 per million writes replicated to a Global Table $0. 25 per million reads $0. 25 per GB after 25 GB $0. 09 per GB of data transferred Optionally, $0. 20 per GB of backup data, and $0. 15 per GB if you have to restore a table
All in all, DynamoDB is priced fairly similarly to other AWS services, and with everything being as metered as it is, you can be sure you’re not overpaying by running unnecessarily large EC2 instances. You can also provision capacity in advance, which is slightly cheaper.
ElastiCache: In-Memory Store
If you want to run Redis or Memcached as a service, AWS offers that as well with ElastiCache.
Redis and Memcached are extremely fast databases that operate entirely within memory. They’re commonly used to store short bits of data such as strings and bytes that need to be accessed very quickly, and with very low latency.
Redis is commonly ran on the same server alongside other applications to make latency as low as possible (in which case, you wouldn’t use ElastiCache), but it can also be used as separate service for large databases, which is where ElastiCache starts to become useful. Compared to EC2, ElastiCache is still a premium, though not by too much. You’ll probably want to use AWS’s “Memory Optimized” instances if you’re running a particularly large database.
Neptune: Graph Database
Graph databases store data in a wholly unique structure. Rather than storing data as rows and columns or key-value pairs, graph databases are used to represent the links between objects, and are used to understand the complex relations between them.
The most common example is social networks. Finding a person’s friends is easy, perhaps you’re storing that as an array on the user’s object, so you’ll simply need to look up the records for each friend. But if you wanted to look at friends of friends, or even deeper, relational databases will grind to a complete halt:
For a graph database though, this process is trivial, and scales quadratically with the number of records returned, rather than factorially.
Neptune is AWS’s own proprietary graph database. The pricing is similar to RDS—pay for the EC2 instance and storage. However, you aren’t able to run Neptune yourself, as it’s not open source. You can always run a different graph database like neo4j if you don’t want to use a managed service.