Connecting a private RDS instance with a Lambda function

0

I'm trying to establish a connection between an AWS Lambda function and a private Amazon RDS PostgreSQL instance that are both situated within the same Virtual Private Cloud (VPC). I've taken the following steps:

  1. Placed the Lambda function and the RDS instance in the same VPC.
  2. Created a security group (Lambda-SG) for the Lambda function.
  3. In the inbound rules of the RDS security group (RDS-SG), I've allowed access from Lambda-SG.
  4. Attached the AWSLambdaVPCAccessExecutionRole to the Lambda function.

I'm encountering below issues. Could anyone guide me through the necessary configuration steps to successfully connect the Lambda function to the private RDS PostgreSQL instance?

"errorMessage": "FATAL: no pg_hba.conf entry for host "XX.X.X.XX", user "postgres", database "XXXXX", no encryption\n", "errorType": "OperationalError",

3개 답변
2

It looks like you're seeing the issue described in the documentation - have you tried the remediation steps there?

The error message you're getting tells me that the Lambda function is connecting to the database correctly at a networking level; but the database is denying access based on its configuration.

profile pictureAWS
전문가
답변함 9달 전
profile picture
전문가
검토됨 9달 전
profile pictureAWS
전문가
검토됨 9달 전
1

The no encryption part of the error message is worth looking into, is PostgreSQL configured to force SSL for connections? https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/PostgreSQL.Concepts.General.SSL.html

If it is then the lambda code will need to enable SSL too.

profile picture
전문가
Steve_M
답변함 9달 전
0

Your IAM permissions issue kindly allow API Access, RDS Access.

Afshaar
답변함 9달 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠