قالب وردپرس درنا توس
Home / Tips and Tricks / The best solutions for running a database on AWS – CloudSavvy IT

The best solutions for running a database on AWS – CloudSavvy IT



AWS logo

AWS has a whole 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 always use EC2

Many of the databases in this list simply use EC2 under the hood to do all the heavy lifting. If you feel comfortable managing all the settings, handling, backups, replication and scaling yourself, you can use EC2 and install the database software manually. This is a completely profitable alternative, 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 in this list will cost a premium compared to the underlying EC2 instance (save for DynamoDB, which does not use servers).

Running on EC2 works especially well if you run a small database and want to reduce costs, as the pricing for the smaller EC2 cases is quite cheap. If you already have an EC2 instance and do not maximize it, you can run a database with your other programs instead of getting a separate instance for the database.

AWS RDS hosts most relational databases

RDS

AWS RDS is their general purpose database service. It runs on EC2, but creation, read replications and incremental backups are handled entirely for you. You simply pay for the underlying EC2 instance (at a small premium) plus EBS storage costs.

Creating a database is easy; from the RDS console, click “Create Database” and enter the desired instance type. You pay for this instance plus the storage provided. 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 having a database as a service, RDS will still benefit some people.

AWS Aurora

Aurora is AWS ‘own relational database. It is MySQL or PostgreSQL compliant, but uses a different underlying engine. It can be selected as an option when configuring a database in RDS.

AWS claims that Aurora is three times faster than PostgreSQL and MySQL, which is an improvement, but it is not as spotty as it may seem. It’s just faster with high-end IOPS (disk speed) in large database instances, and it’s much more expensive if you really want speed.

As a general database, Aurora works well, but is a bit more expensive than other RDS offerings such as MySQL. However, there is a serverless option for Aurora, which seems to reduce costs quite a bit and lets your database autoscale up and down.

AWS DocumentDB: MongoDB compliant

DocumentDB

DocumentDB is AWS replacement for Mongo. It is not actually Mongo under the hood, but it works as such and is fully compatible with existing Mongo drivers. It’s easy to boot from the DocumentDB console and can scale to millions of requests per second with up to 15 read replicas.

DocumentDB works in the same way as RDS in that you pay for the underlying EC2 instance, but 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 db.r5.large instance that costs $0.277 per hour, or about $ 200 per month. This is also a small cost increase compared to MySQL on RDS, so it will definitely come at a premium compared to traditional MongoDB on EC2.

AWS DynamoDB: Server-free NoSQL database

DynamoDB is special because it is the only database in the list that is completely server-free. It is offered as a service like S3, and there are no cases for you to deal with. The entire calculation is handled by AWS.

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

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

  • $ 1.25 per million printers
  • $ 1.875 per million writings 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 priced fairly similar to other AWS services, and with everything measured as it is, you can be sure that you are not paying too much by running unnecessarily large EC2 instances. You can also provide capacity in advance, which is slightly cheaper.

ElastiCache: In-Memory Store

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 work completely in memory. They are commonly used to store short pieces of data such as strings and bytes that must be accessed very quickly and with very low latency.

Redis is usually run on the same server together with other applications to make latency as low as possible (in which case you would not use ElastiCache), but it can also be used as a separate service for large databases, this is where ElastiCache starts to become useful. Compared to EC2, ElastiCache is still 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. Instead of 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 relationships between them.

The most common example is social networks. It’s easy to find a person’s friends, you might store it as an array on the user’s item, so you just need to look up the records for each friend. But if you wanted to look at friends of friends, or even deeper, relationship databases will stop altogether:

neo4j benchmark
Comparison index for neo4j, a popular graph database

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

Neptune is AWS ‘own patented graph database. Pricing is similar to RDS – pay for the EC2 instance and storage. However, you can not run Neptune yourself because it is not open source. You can always run another graph database like neo4j if you do not want to use a managed service.


Source link