J Seabolt
J Seabolt

Reputation: 2998

"no pg_hba.conf entry" error when connecting to AWS RDS database

I'm attempting to set up a basic free tier AWS RDS postgres database. I have done this before, today. For some reason, I am suddenly unable to connect to any new databases I set up. I get this error when attempting to connect to the instance via sequeltron:

Error invoking remote method 'DB_CONNECT': error: no pg_hba.conf entry for host "66.31.166.89", user "postgres", database "playground", no encryption

I do not know why this is happening. Can someone enlighten me?

Upvotes: 0

Views: 1547

Answers (3)

Youssef
Youssef

Reputation: 11

To resolve this issue, update your database instance's Parameter Group settings:

1. Set the parameter rds.force_ssl to 0.
2. Attach the updated Parameter Group to your database instance.
3. Restart the database instance to apply the changes.

After the restart, try establishing the connection again.

source: how to fix "FATAL: no pg_hba.conf entry for host" for aws rds postgres

Upvotes: 0

AxB
AxB

Reputation: 695

If you are using PostgresSQL 15 or later this can be resolved by setting rds.force_ssl value to 0 in DB parameter group.

AWS has defaulted to 1 (on) since PostgresSQL 15

You can require that connections to your PostgreSQL DB instance use SSL by using the rds.force_ssl parameter. The rds.force_ssl parameter default value is 1 (on) for RDS for PostgreSQL version 15 and later. For all other RDS for PostgreSQL major versions 14 and older, the default value of this parameter is 0 (off). You can set the rds.force_ssl parameter to 1 (on) to require SSL/TLS for connections to your DB cluster. You can set the rds.force_ssl parameter to 1 (on) to require SSL for connections to your DB instance.

Upvotes: 0

John Rotenstein
John Rotenstein

Reputation: 270134

When connecting to an Amazon RDS PostgreSQL database, you need to enable SSL on the connection.

You did not show us the code you are using for the connection, but there would normally be an ssl or encryption option you can activate.

Upvotes: 1

Related Questions