AWS has hundreds of services available through their console or through their SDK. Amazon RDS is one of the most commonly used services.
What is RDS?
Amazon RDS standards for Relational Database Service – essentially it’s a large collection of different SQL databases. All of the database options are designed for high availability by utilizing AWS’ cloud services. If you look carefully you might even notice that many of them run EC2 in the background although you won’t be able to log into the virtual os or ssh in.
RDS isn’t serverless with the exception of Aurora Serverless so expect there to always be an on cost.
Why Not Setup My Own Servers?
If you don’t take into account the staff time required to setup, and maintain servers it’s probably a lot cheaper than using the prebuilt AWS ones. When a company invests in technology the ROI needs to be clear, there needs to be a point of differentiation from competitors. Managing databases isn’t typically a good point of differentiation.
Managed database services allow us to save time and avoid needing to have multiple specialized staff in the IT department. Using RDS allows us to quickly setup the service and provision the necessary infrastructure without worrying about patching, purchasing, or backing up data.
We can configure all of that automatically from the console or by using CloudFormation or TerraForma.
Moving From On-Premise to the Cloud
For the most part, the engines work almost identically as they would in the on-premise versions. There’s a Database Migration Service that’s available too that should help reduce downtime and copy a lot of the same configuration.
With RDS and Aurora, we can scale compute and memory up and down as needed. Scaling operations can usually be done in a few minutes with a few clicks or a short script change.
AWS RDS Main Features
RDS is built to scale and be fault-tolerant. If you lose the primary database a secondary database located in a different Availability Zone will be used automatically. This isn’t a performance improvement, it’s used for disaster recovery.
A Read Replica is used to provide improved performance and durability – essentially when doing Read querieis (“select”) you use the Read replica database to query and all other databases happen on the primary (or master) database. For heavy read database workloads it becomes possible to handle signficant traffic without having to do things like sharding and caching.
In my blog post 6 Tips For Better Handling Traffic Spikes we talk quite a bit about database performance and using caching and read replicas.
Read Replicas also give us the advantage of having a ready database in case the primary database suddenly fails.
- Enabled by default
- RDS automatically will do backups that can be kept for a maximum of 35 days.
- When you do a data recovery AWS
- Backup data is stored in S3 and will be deleted once the original RDS instance is removed.
Snapshots are designed really to protect from human error and potential database bugs. RDS Snapshots are copied to S3 storage which is then replicated to 3 datacenters within a region. You should ideally be downloading a backup frequently so you potentially could restore things if you lost access to your AWS account.
Choosing a Database Engine
RDS offers the following relational database options: Amazon Aurora, PostgreSQL, MySQL, MariaDB, Oracle, Microsoft SQL Server
Most of the database instances have per-second billing including licensing costs for Microsoft SQL Server.
Aurora is AWS’ cost-optimized database that is compatible with MySQL and PostgreSQL. It can scale up automatically to handle sudden or unplanned traffic spikes.
You can read more about Aurora in my blog post Introduction to Aurora RDS.
MySQL database is the go to standard in a lot of cases due to it being part of the LAMP stack for a very long time. MySQL is pretty easy to use, set up and includes an open source license.
MySQL is a pretty safe and low risk choice for a company as it’s often taught in many educational courses and follows the SQL Standards pretty well. Developers with MySQL experience tend to be really common and there’s pretty much always a library that supports MySQL available.
Sun acquired MySQL a number of years ago, and shortly after Oracle acquired Sun which caused the community to be concerned.
I don’t really have any experience with MariaDB. MariaDB is a fork of MySQL. As it’s a fork of the original MySQL there’s a lot of clear similarities to the point it’s pretty easy to switch from MySQL to MariaDB because the protocols, APIs, and structures are nearly identical. The tables and data definitions are compatible.
My understanding of MariaDB is that there’s more security features (encryption, additional user controls, etc) and some performance enhancements that aren’t in MySQL. It seems likely that MariaDB will remain open source and that Oracle won’t be able to influence it’s roadmap if that is a concern for you. I tend to work on large enterprise systems that may involve the Oracle database, so it’s not a huge concern for me.
I haven’t used Oracle on AWS so I can’t really speak a lot about the advantages of it. I know that AWS can provide a license (“License Included”) or only the service (“Bring Your Own License BYOL”). I believe that Oracle RDS has hourly pricing but don’t really know much else about it. I’m assuming they have automated a lot of the administration tasks and can handle scaling like they do with other database systems.
PostgreSQL (or Postgres as it used to be called) has been around a long time and emphasizes extensbility and SQL compliance. It’s very popular and is the default database on the macOS Server and has versions for Windows, Linux, etc. Postgres was built with replication in mind and is really highly configurable.
For the most part, PostgreSQL is a very safe choice for a PHP, Node.js or .NET project.
Microsoft SQL Server
The SQL Server RDS offering is fairly limited compared to what you might get on your own servers. For example, it doesn’t include SQL Server Integration Service, or SQL Server Reporting Services. Like the Oracle offerings, AWS has BYOL and License Included offerings.
They allow much shorter billing periods though than Oracle’s 1 hour limit.
Wrapping It Up
AWS relational database service offers a whole lot of functionality without the burden of a lot of the administration. This allows your technology team to work on offering points of differentiation instead of focusing on keeping the ship running.