Automatically set up connectivity between Amazon RDS or Aurora database and AWS Lambda in minutes

· 2 min read
Automatically set up connectivity between Amazon RDS or Aurora database and AWS Lambda in minutes

The Amazon RDS console now offers the feature of automatically setting up connectivity between Amazon RDS or Aurora database and AWS Lambda in minutes. This feature helps to eliminate manual tasks such as configuring VPC, security groups, subnets, ingress/egress rules, and RDS proxy and boost productivity.

In this post, we'll quickly check this new feature.

Let's create a PostgreSQL RDS database in the free tier.

create a PostgreSQL RDS database

The "Set up Lambda connection" option will enabled once the database becomes available.

When the database is in "available" status, go to the "Actions" dropdown and click the "Set up Lambda connection" action.

Set up Lambda connection

Here, you can choose an existing AWS Lambda function or create a new one.

ℹ️
If you choose the "Create new function" radio button and provide the Lambda function name, then by default, the lambda runtime is set to Nodejs.18.

You can create connectivity between AWS Lambda and Amazon RDS with or without an RDS proxy. Accordingly, select the "Connect using RDS proxy" checkbox.

Without RDS proxy:

With RDS proxy:

Connect using RDS Proxy connection summary

Once the connection setup is successful for the Amazon RDS database and AWS Lambda function, click the "View details" button.

Connection setup successfully for RDS database

We can see behind the scenes, it has automatically created security groups, inbound and outbound rules, IAM roles and policies,  secret manager, lambda, and RDS proxy etc.  Network connectivity is set up in a secure and scalable way within minutes. This will definitely expedite the development and increase the productivity.

Lambda connection details

References