I am following the step by step instructions from this link https://www.postgresqltutorial.com/connect-to-postgresql-database/ here to create a simple server on pgadmin. Please check the picture
What am I doing wrong, I installed pgadmin on my macOS but I don't see why I am getting this error. Please help
Best Answer
It's an issue with AWS inbound rules not pgAdmin. Follow this guide to solve it. It works.
In the file pg_hba.conf
you have to change:
host all all <your_ip/mask> ident
to:
host all all <your_ip/mask> md5
<your_ip/mask>
is your ip address where you are connecting from.For example 10.1.1.5/32
.
You have to add one if it doesn't exist yet.
I'm using CentOS so the file pg_hba.conf
is located in /var/lib/pgsql/data
for me. If you don't know where the file is located on your OS you can use the search to find the file.
What worked for me is before saving go to advanced tab and in connection timeout give 100 or any bigger number and then save.
- Go to "Security group rules" (under "Connectivity & security")
- Click the item "default" Security group
- Click "Actions" > "Edit inbound rules" > "Add rule"
- Select... Type: "All traffic", Source: "My IP", then click "Save rules"
Same issue for me with a brand new Debian 10 installation.
pg_hba.conf#IPv4 local connections:host all all all md5#IPv6 local connections:host all all all md5postgresql.conflisten_addresses = '*'
I restart postgresql service after with sudo service postgresql restart
. Status is active and when I run
netstat -nlp | grep 5432
I get
tcp 0 0 0.0.0.0:5432 0.0.0.0:* LISTEN 1071/postgrestcp6 0 0 :::5432 :::* LISTEN 1071/postgres
In this example I add all hosts, I know it's not a secure way, but it's still a test, I will filter by Ip adresses after.
Is there a particular configuration with nftables
firewall to set up ?
You may need to pass the port from the firewall
try that:
sudo ufw allow 5432/tcp
First make sure, your AWS RDS instance is set to be publicly accessible.
If the error persists, check these two things. Make sure the Route Table attached to your public subnet:
has been set as main route table. To do this: go to VPC dashboard in AWS console >> Select "Route tables" option from the left link >> Select your route table >> From the "Actions" button click on "Set main route table" from the dropdown menu
has the route for the Internet Gateway that you're using in your VPC. You can check this on the "Routes" tab in the lower pane of your route table.