Trouble connecting to my RDS database from local machine during testing

0

I have updated all security groups on my instance to allow incoming traffic from my IP but i continually get an error that no pg_hba.conf entry for host "My-IP-Address". Its frustrating because i got it working yesterday with no issues. I ran some testing locally and then it stopped allowing me to connect from my local machine. When i run netcat it tells me that its open for connections. So its open and available. I can connect directly from my ec2 instance but not from my local machine during testing. Which is really inconvenient for testing.

posta 4 mesi fa254 visualizzazioni
2 Risposte
2

Hello.

Can I check the error log on the RDS side?
I think it is necessary to check by outputting the error log etc.
https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_LogAccess.Concepts.PostgreSQL.html

profile picture
ESPERTO
con risposta 4 mesi fa
profile picture
ESPERTO
verificato 4 mesi fa
profile pictureAWS
ESPERTO
verificato 4 mesi fa
  • By the way, there is a way to fix a similar error by changing the value of "rds.force_ssl" to 0 and restarting. It may not be relevant in your case, but please check to be sure. "rds.force_ssl" can be set in the parameter group set for the RDS instance. https://github.com/dbeaver/dbeaver/issues/21616#issuecomment-1777371491

  • here is what the error logs most recent entries:

    2024-07-19 14:03:19 UTC:172.31.95.246(51698):postgres@trading_app_db:[29320]:FATAL: no pg_hba.conf entry for host "172.31.95.246", user "postgres", database "trading_app_db", no encryption 2024-07-19 14:03:43 UTC:70.94.81.154(51694):postgres@trading_app_db:[29344]:FATAL: no pg_hba.conf entry for host "70.94.81.154", user "postgres", database "trading_app_db", no encryption

  • This is an error because you are not using an SSL connection when connecting. Therefore, turn off SSL connections by setting "rds.force_ssl" in the RDS parameter group to 0, or set the option to use SSL connections when connecting.

0

Hi, Since you are accessing the database using your local machine via the internet, You would need to enable Public access while creating the instance - RDS assigns a public IP address to the cluster. Amazon EC2 instances and other resources outside of the VPC [such as your local machine] can connect to your cluster. Resources inside the VPC can also connect to the cluster.

Additionally double check if your IP address is correctly set in the security group and hasn't changed. You can use https://checkip.amazonaws.com/ to find your current IP.

If both the above don't work, you can use debugging steps mentioned here: https://repost.aws/questions/QUEFYFdq8_S4Kqw0DRLCtPXQ/cannot-connect-to-my-rds-mysql-from-my-local-pc-security-groups-already-configured-properly

Thanks, Rama

profile pictureAWS
ESPERTO
con risposta 4 mesi fa
  • thanks for the response. The RDS instance does have public access enabled. I have doubled checked my IP address and how they are setup in the security groups. I will look into the additional debugging steps.

Accesso non effettuato. Accedi per postare una risposta.

Una buona risposta soddisfa chiaramente la domanda, fornisce un feedback costruttivo e incoraggia la crescita professionale del richiedente.

Linee guida per rispondere alle domande