1

I'm trying to make rds with postgres work with lambda, but no luck so far. I've read all other threads about it here, double-checked my Lambda VPC + Subnet config, it's the same as the RDS one, but still no luck connecting, what am I missing here?

Some screenshots to clarify: enter image description here enter image description hereenter image description here

Before, I enabled the Public access and I could connect through serverless offline.

Thanks!

EDIT ---- enter image description here

17
  • Hello @Leonardo. Do you have any logs from CloudWatch about execution of Lambda? Does your role used by Lambda has AssumeRole policy attached? Commented Mar 26, 2018 at 22:26
  • 1
    Can you post your security group details? have you opened the port to lambda? Commented Mar 27, 2018 at 6:46
  • Can you post the IAM policy attached to your Lambda, the execution role? Commented Mar 27, 2018 at 13:36
  • @strongjz the print provided has all the policies. Commented Mar 28, 2018 at 1:46
  • @jpact I couldn't find this role... All the policies that I have for this lambda is in the print, in the question :D Commented Mar 28, 2018 at 1:46

1 Answer 1

2
+50

Have you verified your security group for your RDS service? It needs to allow access from the security groups given to your Lambda function. It is not enough that they are in the same VPC/subnets. The security group still needs to allow traffic on the ports for postgres (5432).

Note that for security groups you don't have to select an origin IP (which can be tricky for Lambda). But i notice you are giving your Lambda function the group sg-29aac25d. You can use that ID to give access to the RDS.

IAM policies should be irrelevant as you are authenticating against postgres. Unless your IAM doesn't allow your Lambda to execute, the problem is not IAM.

Sign up to request clarification or add additional context in comments.

1 Comment

Thank you, after adding my default vpc to my rds security group it worked!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.