Managed Relational Databases with AWS RDS and Aurora
Tags: aws, cloud, database
Published: 2023-08-24 13:55:00

Note: This content was originally published at the **[Simple AWS newsletter](https://www.simpleaws.dev?utm_source=blog&utm_medium=dev.to)**. Understand the Why behind AWS Solutions. Subscribe for free! 3000 engineers and tech experts already have.

In AWS there are two services that provide a managed installation of a relational database: Relational Database Service (RDS) and Aurora. Aurora is technically grouped under the list of available database engines for RDS, but its behavior is a bit different in some key areas, so it's worth considering it separately.

To understand what they do, imagine that you create an EC2 instance, install your favorite database engine (e.g. MySQL or Postgres), configure automated backups, set up monitoring tools, and so on. RDS and Aurora let you create in a few clicks an instance that's essentially like that, but everything is already set up for you. You still need to configure things that aren't part of the instance, like what VPC and subnet it's going to launch on, associated security groups, etc. But those work just like for EC2 instances.

RDS lets you use MySQL, MariaDB, Microsoft SQL, Oracle or PostgreSQL as a database engine. Aurora only supports MySQL up to 8.0 and Postgres up to 14.3 (those are not the latest versions of those engines). The reason is that Aurora doesn't actually use native MySQL or Postgres, but instead a rewrite of those engines made by AWS, which is fully compatible with the original MySQL and Postgres versions, but optimized to work better in AWS's infrastructure. 

## Benefits of Amazon Aurora over RDS

These are the ways in which Aurora works better than RDS, thanks to the optimizations performed by the AWS team:

* In Aurora, read replicas also act as failover replicas

* Aurora is better optimized to use EBS volumes, achieving better throughput on disk operations

* With Aurora you don't need to provision storage capacity before using it, it's provisioned automatically and you only pay for what you actually consume. You can still configure EBS volume types and other parameters like IOPS.

* You can use Aurora in serverless mode, allowing you to scale your database's compute capacity horizontally. It works similar to [DynamoDB in Provisioned Mode](https://newsletter.simpleaws.dev/p/dynamodb-scaling-provisioned-on-demand?utm_source=blog&utm_medium=dev.to), and it's approximately 3x more expensive than Aurora in serverful mode (without taking into account the reduction in unused capacity).

Aurora supports global databases, which are backed by two or more Aurora databases in different regions.

## Best Practices for RDS and Aurora

* If you're going to use Postgres or MySQL, prefer to use Aurora if possible.

* Purchase [Reserved Instances](https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/USER_WorkingWithReservedDBInstances.html) for your RDS or Aurora databases, to save up to 60% on database instance costs.

    * Keep in mind that in Aurora [reserved instances are flexible](https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/USER_WorkingWithReservedDBInstances.html) (i.e. if you move to a larger instance size you still get benefited from the reservation)

* Consider whether Aurora Serverless is a good fit for your use case

    * Always use Aurora Serverless v2, Serverless v1 is fading out

    * Remember that it's 3x more expensive. That means, it'll be cheaper if you're using less than 33% of your DB instance's capacity on average

    * You also get the benefit of scaling beyond your planned capacity with no preparation and no manual intervention

    * Keep in mind that it doesn't scale immediately, it may take a few minutes to detect the need to scale and increase capacity

* If you have some read-heavy users or use cases (such as reporting), consider adding a read replica and performing read operations from the reader endpoint

* If you need high availability, set up a failover replica in a different Availability Zone. Remember that in RDS read replicas and failover replicas are different concepts, while in Aurora replicas act both as read replicas and failover replicas at the same time.

* Always consider whether you actually need a relational database. NoSQL databases such as DynamoDB can handle most typical use cases with [the right database design](https://newsletter.simpleaws.dev/p/dynamodb-database-design?utm_source=blog&utm_medium=dev.to), and they even support [transactions](https://newsletter.simpleaws.dev/p/dynamodb-transactions?utm_source=blog&utm_medium=dev.to).

## Recommended tools for working with RDS or Aurora

If you're considering a relational database for an event-driven architecture, check out [Debezium](https://debezium.io/). It lets you stream changes to relational databases, and subscribe to change events.


---

Understand the Why behind AWS Solutions.
Join over 3000 devs, tech leads, and experts learning how to architect cloud solutions, not pass exams, with the [Simple AWS newsletter](https://www.simpleaws.dev?utm_source=blog&utm_medium=dev.to).

* Real-world scenarios
* The Why behind solutions
* How to apply best practices
    

[Subscribe for free!](https://www.simpleaws.dev?utm_source=blog&utm_medium=dev.to)

<iframe src="https://embeds.beehiiv.com/1c90a8a9-57b7-4a3f-ac56-5f05d0121f72?slim=true" style="margin:0;border-radius:0px;background-color:transparent;display:block;margin-left:auto;margin-right:auto" height="55px"></iframe>

If you'd like to know more about me, you can find me [on LinkedIn](https://www.linkedin.com/in/guilleojeda/) or at [www.guilleojeda.com](https://www.guilleojeda.com?utm_source=blog&utm_medium=dev.to)