AWS Lambda not able to connect to public RDS instance
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?
Yes.. it is <dbname>.<...>.ap-south-1.rds.amazonaws.com
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.
Relevant questions
Can't connect to RDS database from remote
asked 3 months agoIssues connecting to Postgres RDS instance from within a VPC
asked 3 years agoAWS Lambda not able to connect to public RDS instance
asked a month agoCan't connect to an RDS Instance from Lambda (different account tough)
asked 2 years agoCan we create a Table in Aurora during the infra setup using terraform IaaC code ?
Accepted Answerasked a month agoPlacing a Bastion in a Private Isolated Subnet
asked 3 months agoAccess Denied error when using Lambda IAM role to access Amazon RDS for MySQL
Accepted Answerasked 2 years agoRotation lambda timing out but using Secrets Manager VPC Endpoint
asked 2 years agoHandler error when connecting lambda function to RDS database
asked 2 months agoWhy can't I find my RDS database from my lambda function?
asked 2 months ago
Are you using the public RDS endpoint as host name? (....<region>.rds.amazonaws.com)