Serverless Relational Database Service?

By Chris Maki | December 3, 2018

Does AWS Support Serverless RDS?

If you are like me, you may have missed the Aurora Serverless MySQL announcement back on August 9th, 2018. This is a pretty amazing addition to the already impressive list of Serverless options provided by AWS. Most of us are familiar with AWS Lambda and when you talk to someone about Serverless computing, Lambdas are likely to come up. Did you know there’s a lot of other Serverless computing options? Just about every service offered in the cloud has a Serverless computing counterpart. Some services are only available in a Serverless model, like S3; while other services, like databases, come in both a Serverless - DynamoDB (a NoSQL database) and managed configuration.

What’s the difference?

Aren’t DynamoDB and RDS both managed services from AWS? Yes, they’re both managed services, but a few key differences:

Cost model

You’re not charged when your database is idle, with traditional RDS you’re changed even when you database is idle

Availability

By default, all Serverless offerings provide High Availability, with non-Serverless options you need to configure the service to have High Availability

Fault Tolerant

It’s built-in with Serverless, you need to enable or configure this for your non-Serverless service

Scalability

All Serverless offerings are scalable, it’s enabled by default, you don’t need to do anything. You need to configure scalability for non-Serverless services

Create your Serverless Aurora Database

Let’s create a Serverless database. Navigate to the AWS Console and select RDS, or search for RDS using the service finder. Here’s the homepage for Amazon RDS.

RDS Homepage

Click the, "Create database" button and you’ll be taken to the "Select engine" page. With Amazon Aurora selected, you’ll see the Serverless, "MySQL 5.6-compatible" option, make sure you select this one, then click Next.

Choose RDS type

One the "Specify DB details" you can choose different "Capacity type" options, select Serverless. If you select one of the other capacity options, you’d also have to select the EC2 instance type and decide if you want a multi-az deployment. With Serverless, as you can see below, it’s handled automatically for you.

Choose the DB type

On the last page of the "Create database" wizard, the "Configure advanced settings" page, you can choose the minimum and maximum Aurora capacity units (ACU) and specify when the DB will be paused. An ACU is a combination of memory and processing capacity. By default, the "Additional scaling configuration" section is collapsed, expand this section (as shown below) to set your DB timeout. The inactivity time is set to five minutes (which is also the minimum inactivity setting) and you can adjust this to whatever time interval you’d like. Ideally, you’ll want to keep this value as low as possible so you are not paying for idle resources.

Choose the DB type

Any open connection to your Aurora database counts as activity, so if you’re like me and leave your msql client running all night, your Aurora Database will never pause.

If any open connection to your DB keeps it running, when would it ever pause? Great question, depending on your needs, you Serverless DB may always be running. If this is your situation, why would you want to use a Serverless Database? Great question, as mentioned earlier, there are many other advantages provided by a Serverless database in addition to, pausing when not in use.

How to keep your DB paused

If you want to pause your database as often as possible, consider using a Lambda. Since a Lambda is a Serverless function, it isn’t connected to your database when there’s no activity. Only when the Lambda executes does it open a connection to the database. Aurora Serverless is optimized to integrate efficiently with other AWS services, because of this there is a low-latency connection between your Lambda function on the database.

In my testing, it can take about 15 seconds for the database to restart. I had to adjust my Lambda timeout to accommodate the Database restart timing.

Let me know what your experiences are with Amazon Aurora Serverless.

Updates

  1. 2/05/19 - move from WordPress to Hugo

  2. 2/15/19 - updated all formatting with move to full hugo site

comments powered by Disqus