2

I am trying to connect to a free AWS RDS PostgreSQL database I created using SQL Workbench/J, I am following the instructions provided from AWS.

When I get to the end of Step 4, connecting to the PostgreSQL database, I keep receiving this error:

The connection attempt failed. [SQL State=08001]

I am using a Mac.

user14656359
  • 21
  • 1
  • 2
  • "The connection attempt failed" typically means that there is a network problem. Usually the database host can't be reached from the computer where you run SQL Workbench/J. You can try if the database server is reachable at all by using `ping name_of_database_host` on the command line –  Nov 17 '20 at 16:57
  • Can you connect a regular PostgreSQL cli to it? – jarmod Nov 20 '20 at 13:57

2 Answers2

2

I fixed this by adding an Inbound connection rule for the database. From the AWS RDS portal goto: databases -> <your_database>. Then scroll down and ensure the 'Connectivity & security' tab is chosen. Scroll down to 'Security group rules' then follow the link for the 'EC2 Security Group - Inbound' rule. On this page, select the 'Inbound rules' tab and select the 'Edit inbound rules' button. Select 'Add Rule', the type for me was PostgreSQL, protocol TCP, I used the port the database instance is supposed to operate on (found on the AWS RDS - Connectivity & security tab for the particular database) -- i.e. 5432. Next, for Source open the drop down menu and choose 'My IP', then save changes. That was it for me.

user608578
  • 211
  • 2
  • 5
0

To solve this error, go to your RDS database on AWS and click on "Modify". Now go to Connectivity and click on "Choose Security Group". Click on any of the launch-wizard options there for example "launch-wizard-1". Now save the changes. Then go to sqlworkbench and connect again. Your error will get solved.