The Best Solutions For Running a Database on AWS

AWS Logo

AWS offers an entire category for its managed database services, which makes it easy to create and run a database on the AWS platform. What do they offer and is it better than running it yourself on EC2?

You can still use EC2

Most of the databases on this list just use EC2 under the hood to do all of the heavy lifting. If you are ready to handle all of the configuration, management, backups, replication, and scaling yourself, you can use EC2 and install the database software manually. This is a very viable option, even for large databases.

The advantage of a service like RDS is that the whole process is handled for you, but it costs extra money. Each Database as a Service on this list will cost more than the underlying EC2 instance (except DynamoDB, which does not use servers).

Running on EC2 works especially well if you are running a small database and want to keep costs down, as the price of small EC2 instances is quite cheap. Also, if you already have an EC2 instance and are not maximizing it, you can run a database with your other programs rather than getting a separate instance for the database.

AWS RDS hosts most relational databases

RDS

AWS RDS is their general purpose managed database service. It works on EC2, but creation, read replicas, and incremental backups are all handled for you. You just pay for the underlying EC2 instance (for a small fee), plus the EBS storage fee.

Creating a database is easy; of RDS Console, click on “Create database” and specify the desired type of instance. You will pay for this instance, plus provisioned storage. In general, RDS is a little more expensive than just using the underlying EC2 instance and configuring everything yourself. But, with all the benefits of having a database as a service, RDS will still be of benefit to some people.

AWS Aurora

Dawn is AWS’s proprietary relational database. It is MySQL or PostgreSQL compatible, but uses a different underlying engine. This option can be selected when configuring a database in RDS.

AWS claims that Aurora is three times faster than PostgreSQL and MySQL, which is a huge improvement, but it’s not as flashy as it sounds. It’s only faster with high provisioned IOPS (disk speed) on huge DB instances, and it costs a lot more if you’re really looking for speed.

As a general database, Aurora works fine, but is a bit more expensive than other RDS offerings like MySQL. There is, however, a serverless option for Aurora, which seems to reduce costs a bit and allows your database to scale up and down automatically.

AWS DocumentDB: MongoDB compatible

DocumentDB

DocumentDB replaces Mongo with AWS. It’s not really Mongo under the hood, but it acts as such and is fully compatible with existing Mongo drivers. It is easy to launch from the DocumentDB Consoleand can scale to millions of requests per second with up to 15 read replicas.

DocumentDB works the same as RDS in that you pay for the underlying EC2 instance, but it’s worth noting that instance selection is limited to memory-optimized R5 instances, which aren’t 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 over MySQL on RDS, so it is definitely a premium over traditional MongoDB on EC2.

AWS DynamoDB: Serverless NoSQL Database

DynamoDB is special in that it is the only database on this list that is completely serverless. It’s offered as a service like S3, and you don’t have to manage any instances. All the computation is handled by AWS.

DynamoDB is a key value and document database, similar to MongoDB. It’s a little different though, but AWS offers migration tools for the transition to DynamoDB from MongoDB and MySQL.

You are billed based on requests and storage, although the list of taxes is a bit long:

$ 1.25 per million entries
$ 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
Optional $ 0.20 per GB of backup data and $ 0.15 per GB if you need to restore a table

Overall, DynamoDB is quite similar price to other AWS services, and with everything being as measured as it is, you can be sure that you’re not overpaying by running unnecessarily large EC2 instances. You can also capacity provision in advance, which is slightly cheaper.

ElastiCache: memory storage

If you want to run Redis or Memcached as a service, AWS also offers it with ElastiCache.

Redis and Memcached are extremely fast databases that run entirely in memory. They are commonly used to store short bits of data, such as strings and bytes, which must be accessed very quickly and with very low latency.

Redis is typically run on the same server alongside other applications to keep latency as low as possible (in this case you are not using ElastiCache), but it can also be used as a separate service for large databases, ie. This is where ElastiCache starts to come in handy. Compared to EC2, ElastiCache is always a premium, but not too much. You will probably want to use AWS “Memory Optimized” instances if you are running a particularly large database.

Neptune: graph database

Graph databases store data in a completely unique structure. Rather than storing data in the form of rows and columns or key-value pairs, graph databases are used to represent the relationships between objects and to understand the complex relationships between them.

The most common example is that of social networks. It’s easy to find a person’s friends, maybe you store them as a table on the user’s object. So you just need to search the records of each friend. But if you wanted to look at friends of friends, or even deeper, relational databases will shut down completely:

neo4j benchmarkBenchmark of neo4j, a popular graph database

For a graph database however, this process is trivial and evolves quadratically with the number of records returned, rather than factorially.

Neptune is AWS’s own proprietary graphics database. Pricing is similar to RDS: pay for EC2 instance and storage. However, you cannot run Neptune yourself, as it is not open source. You can always run a different chart database like neo4j if you don’t want to use a managed service.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.