AWS Lambda not able to connect to public RDS instance

0

I have a public RDS instance running postgres. I can connect to it from my local host. The same function fails when I try to run it on lambda. The error I get is

***could not translate host name <RDS_HOST_NAME> to address: Name or service not known\n"


There is no VPC associated with the lambda function. I can connect using psq -h <RDS_HOST_NAME> from my machine. Could you please suggest on how to resolve this?

  • Are you using the public RDS endpoint as host name? (....<region>.rds.amazonaws.com)

  • Yes.. it is <dbname>.<...>.ap-south-1.rds.amazonaws.com

已提問 2 年前檢視次數 1431 次
1 個回答
0

I had a similar problem, which I solved with the following steps.

I created a new RDS instance in the management console. At this time, I specified that a new VPC, subnet group, and security group be created as well.

In this case, a rule was created with the source IP "90.149.145.179/32" as an inbound rule for the security group. In this state, I could still connect from the local PC, but not from Lambda. When I changed the source IP to 0.0.0.0.0/0, I was able to connect from Lambda.

profile picture
已回答 2 年前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南