Skip to content

Connecting to RDS DB via Sagemaker Notebook

0

I have created a Sagemaker Notebook in the same VPC as my RDS DB and with the same subnet and security group. When I try to connect to it using psycopg2. I am receiving the following error. I am still new to AWS so I am not able to understand how to check whether the server is accepting TCP/ICP connections.

OperationalError: connection to server at "******.rds.amazonaws.com" (***.***.***.***), port 5432 failed: Connection timed out
	Is the server running on that host and accepting TCP/IP connections?
1 Answer
0

Hello.

Looking at the error message, a timeout error has occurred, so there is a high possibility that the connection to RDS is not possible.
A common cause of timeout errors when connecting to RDS is that the RDS security group does not allow the necessary communication.
In this case, the following settings are required in the inbound rules of the RDS security group.
I think the scenario is similar to the following document.
https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Overview.RDSSecurityGroups.html

TypeProtocolPortSource
PostgreSQLTCP5432Sagemaker Security Group ID

Additionally, there is a possibility that the cause is other than the security group settings, so I recommend that you troubleshoot while referring to the following documents.
https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/CHAP_Troubleshooting.html#CHAP_Troubleshooting.Connecting

EXPERT
answered 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.