i can't successfully connect to RDS from Amazon Lambda in production.
For Amazon Lambda i'm using Serverless framework, executing sls offline i can connect with RDS from localhost, but in production Amazon Lambda doesn't.
Both are in same VPC, in same security group, that has all traffic inbound access, and a rule that is pointing to Vpc's CIDR.
I have these permissions attached: AmazonRDSFullAccess, AWSLambdaFullAccess, AmazonVPCFullAccess, AWSLambdaExecute and AWSLambdaVPCAccessExecutionRole.
Thank's for help.
I had this issue and the following is a summary of the steps I took to resolve:
- In lambda network section select the VPC and all subnets. Set the security group to the security group the RDS was created with / set to.
- Edit said security group inbound policies and set a policy with RDS port/access settings and set the source equal to its own Group Id. It is not sufficient that they are in the same group, if it doesn't accept connections from it's own group.
- Ensure the lambda function execution role has AWSLambdaVPCAccessExecutionRole and AWSLambdaBasicExecutionRole policies attached.
Good luck.
Try to change "IAM DB Authentication Enabled" to YES on your database and apply changes immediately so you don't wait for maintenance.
That solved my problem.