Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Allow AWS Lambda to access RDS Database

I am trying to connect to RDS Database from an AWS Lambda (Java).

Which IP should I enable from the RDS Security group rules?

like image 933
giò Avatar asked May 04 '16 14:05

giò


People also ask

How do I allow Lambda to connect to RDS?

You can configure Lambda to access your RDS instance. You can enable this using Lambda management console. Select Lambda function which need access to RDS instance and then go to Configuration -> Advanced settings and select the VPC (which is your RDS instance is in) you need it to access.

Can Lambda talk to RDS?

Lambda can work seamlessly with RDS instances, as long as you remember the specific requirements for this particular setup. Since RDS instances are running in your VPC and Lambda by default does not have access to those resources, you'll need to configure the VPC connection when creating a Lambda function.

Can AWS Lambda connect to database?

Yes. AWS Lambda can connect to an AWS hosted databases such as RDS or DynamoDB. AWS Lambda can also connect to external databases which are public or grant network access. Dependent on the database you're using (or intending to use) there are some considerations you should address.

How do I allow my AWS Lambda function access to other AWS resources?

You can also use resource-based policies to grant invoke permission to an AWS service that invokes a function in response to activity in your account. Open the Functions page of the Lambda console. Choose a function. Choose Configuration and then choose Permissions.


1 Answers

You can't enable this via IP. First you will need to enable VPC access for the Lambda function, during which you will assign it a Security Group. Then, within the Security Group assigned to the RDS instance you will enable access for the Security Group assigned to the Lambda function.

like image 163
Mark B Avatar answered Oct 03 '22 14:10

Mark B