Relational databases for serverless, can we use them?

Relational databases for serverless, can we use them?

A question often get asked is, if DynamoDB and noSQL databases are the only way to use serverless. When looking at all the content that is out there for serverless (and I can call myself guilty of this as well) it might seem the case for serverless beginners. However, the answer is no, you can use relational databases with serverless.

One mayor problem of relational databases engines is that they are not build for serverless. Relational database engines are build to have a fixed number of connections and when an unpredictable number of functions try to connect to them, they might run out of connections and have all kind of issues.

There are many ways around this, one is RDS proxy . RDS proxy is a new feature of AWS RDS that handle the connections to the RDS databases for you.

Another way to do relational databases in a scalable way for serverless, is to pick a database that was designed for the cloud and serverless use cases. For that you can use Amazon Aurora. Amazon Aurora is a relational database build for the cloud.

Aurora RDS comes in two flavours and one of them is fully serverless, where you don't need manage the scaling of the service at all. During reinvent 2020 it was announced version 2 of this serverless database, that solves a lot of known issues.

You can use Aurora in multiple ways from your AWS Lambda functions, one way is to use the Data API. The Data API allows you to connect to an Aurora database using an API, in a similar way that you do with DynamoDB and you don't need to manage connections. In this way using the database becomes super simple.

You can check a video I did where I build a backend with Aurora and use the Data API

Are you using Aurora database in your applications? Have you tried it already? Or you are a dynamo fan?Let me know!