In this post, I will talk about what and why about the Amazon RDS Proxy Let's get started!

Why relational databases have been hard in Serverless

There were a few major problems with using relational databases in Serverless applications:

  • Pricing model: Relational databases were priced hourly by instance size, whether you're using it or not.
  • VPC cold-starts: Relational databases should be network-partitioned in a private subnet of your VPC where it cannot be accessed from the public internet. However, this means that your Lambda functions need to be in a VPC, which meant occasional cold-starts of up to 10 seconds.
  • Connection limits: Relational databases were built for an era of a lower number of long-running compute instances. They don't fit this world of a high number of hyper-ephermal compute instances. AWS Lambda users may run into connection limits when trying to connect to their relational databases.

Fortunately, AWS has been listening, and each of these issues has been addressed.

How Amazon RDS Proxy and other improvements are making relational databases work in Serverless

First, AWS released Amazon aurora serverless. This is a serverless version of the proprietary Amazon Aurora database that can automatically scale up and down according to your usage. This release helped with the pricing model issues around using a relational database.

Second, AWS announced improved vpc networking for lambda functions This update greatly decreased the coldstart latency for Lambda functions that use a VPC. This makes it more acceptable to use VPC Lambda functions in user-facing applications.

Finally, the amazon rds proxy came and capable of handling the connection limits. Rather than managing connections in your Lambda functions, you can offload that to the Amazon RDS Proxy. All pooling will happen in the proxy so that you can handle a large number of connections in a manageable way.