Lightsail Postgres "no pg_hba.conf entry"

0

Hi,

I have created a managed database in my Lightsail dashboard (PostgreSQL database (15.2) / 240 GB SSD). On the networking tab I have enabled the "Public mode".

I can connect using a desktop client (DBeaver), but when connecting programmatically (from the same machine/IP address) I am receiving:

original: error: no pg_hba.conf entry for host "xxx.xxx.xxx.xxx", user "yyyyyyyy", database "zzzzzzzzz", no encryption

This confuses me greatly because there is no other setting I can make apart from the toggle.

Also, I have an older instance I created a few months ago (PostgreSQL database (12.13) / 40 GB SSD) to which I can connect programmatically, without errors.

When I do a

select * from pg_hba_file_rules;

Against both instances I get very different output. Old instance:

|line_number|type |database     |user_name |address |netmask|auth_method|options|error|
|-----------|-----|-------------|----------|--------|-------|-----------|-------|-----|
|4          |local|{all}        |{all}     |        |       |md5        |       |     |
|10         |host |{all}        |{rdsadmin}|samehost|       |md5        |       |     |
|11         |host |{all}        |{rdsadmin}|all     |       |reject     |       |     |
|12         |host |{rdsadmin}   |{all}     |all     |       |reject     |       |     |
|13         |host |{all}        |{all}     |all     |       |md5        |       |     |
|14         |host |{replication}|{all}     |samehost|       |md5        |       |     |

New instance:

|line_number|type   |database     |user_name |address |netmask|auth_method  |options  |error|
|-----------|-------|-------------|----------|--------|-------|-------------|---------|-----|
|2          |local  |{all}        |{rdsadmin}|        |       |peer         |{map=rds}|     |
|6          |local  |{all}        |{all}     |        |       |scram-sha-256|         |     |
|12         |host   |{all}        |{rdsadmin}|samehost|       |scram-sha-256|         |     |
|13         |host   |{all}        |{rdsadmin}|all     |       |reject       |         |     |
|14         |host   |{rdsadmin}   |{all}     |all     |       |reject       |         |     |
|15         |hostssl|{all}        |{all}     |all     |       |md5          |         |     |
|16         |host   |{replication}|{all}     |samehost|       |md5          |         |     |

Any ideas what I should do to be able to connect?

EDIT1:

I have now completed a completely new instance with

1 GB RAM, 2 vCPUs, 40 GB SSD
PostgreSQL database (12.14)

And I can connect programmatically.

Please advise what changed in DB setups with higher Postgres versions and how I can connect.

It seems to me at this point that the "Public mode" toggle button is broken for the biggest instance with the highest Postgres version. It does not make the instance fully available with just username/password. Something else is needed, something that the DBeaver client apparently does in the background, but I am not aware of.

EDIT2:

I have created an instance with

PostgreSQL database (14.7)
240 GB SSD

And can connect to that. So only the latest Postgres version seems to fail.

Svemir
asked a year ago179 views
No Answers

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.

Guidelines for Answering Questions