I have a lambda that is attempting to connect to an RDS(Postgres) database. This is currently failing with a timeout error.
I have read multiple questions here on SO but I am getting confused by the network settings (I'm not a network person).
So what I currently have is:
A Postgress DB running with
The lambda has the following
The security group has the following rules
Any help appreciated...
Your security group is currently blocking the network traffic from the Lambda function to the RDS server. Simply adding them to the same security group accomplishes nothing, and is actually bad practice. A lot of people mistakenly think that things in the same security group can automatically communicate with each other, but that is not the case at all.
You need to create a separate security group for the Lambda function, without any inbound rules, and with the default outbound rule that allows all outbound traffic. Then you need to add an inbound rule to the RDS server's security group that allows inbound traffic, on port 5342
, with the source being the ID of the security group assigned to the Lambda function.