Anyone using Aurora/MySQL database?

Hi,

I’m thinking in creating some serverless services using a RDS database (Aurora) but I don’t find much information and I have some concerns about performance.
My initial decision was to use a DynamoDB because it’s easy to implement and integrate with Lambda, but I think for the data model I need a relational database would work better, but it seems harder to implement and with some caveats.

  • Will I have problems with cold starts and having to start a new database connection?
  • Will I have performance problems because I’m running lambda inside a VPC?
  • A RDS database is not a good use case for Lambdas?

Thanks!

I can’t speak as to whether establishing a connection to a RDS endpoint would affect performance, but my guess is probably not. Lambda can work fairly seamlessly with RDS.

1 Like

On further thought, VPC configuration, etc. could prove painful if you’re shooting for a true serverless approach.

However, Serverless Aurora was just announced: https://serverless.com/blog/ultimate-list-serverless-announcements-reinvent/#serverless-aurora-coming-soon

1 Like

That sounds great!
Any idea when that should happen?

Thanks!

There are two databases you might use inside RDS: Aurora (which implements mysql 5.6 functionality), and Mysql (which is Mysql 5.7, and hence has things like JSON columns).

I am using both, and both perform very well. Aurora is more self-managing, in that it deals with replication and growing of the database automatically.

Cold starts are not an issue: your application just opens a new connection to the database, just like any other database.

I run RDS inside a VPC, so no direct access from the public Internet is possible, and I also run lambda inside a VPC private subnet. The only tricky bits I had to deal with were:

  1. Having to build a NAT Gateway so that the Lambda function had outbound Internet connectivity (this costs money too, unfortunately, but I wanted all Lambda functions to make outbound connectivity from a fixed IP address)

  2. Configuring an S3 policy to allow access to S3 from the private subnet

HTH, Brian.

2 Likes

I have been using RDS MySQL with APIG and lambda for about 6 months so far without any issues. I am too in a VPC, which means I need to use NAT gateway, but it was not difficult to set up. I can only recommend this setup.

1 Like

Currently Lambda + SQL feels like an anti-pattern. You can do it but there are a number of gotcha’s. For example - You need to run Lambda inside a VPC that has access to the database. That means slow cold start times (cause by running Lambda inside a VPC), Lambda not having internet access by default, etc. You can work around many of these.

I expect this to change once Serverless Aurora is available.

1 Like

How are you handling your database connection pool? D:

Serverless Aurora is intended to be a database for infrequent, intermittent, or unpredictable workloads.