Postgresql – Connecting to Postgres RDS from outside using DataGrip

amazon-web-servicespostgresqlrds

I have setup Postgres RDS instance on AWS. Made it publicly accessible and security group allows all traffic inside and outside.

However I still can't connect from outside network (using DataGrip).

Connection to jdbc:postgresql://name.abcd.eu-west-1.rds.amazonaws.com
:5432/mydb failed. Host name.abcd.eu-west-1.rds.amazonaws.com is
unknown. [08001] The connection attempt failed.

I copied the endpoint from AWS console and I'm using the username and password I entered when creating the instance.

What am I doing wrong?

Best Answer

The problem was in DataGrip itself. It put a space between port and host

 ...amazonaws.com :5432...

To get it working you have to:

  • make instance publicly accessible when creating
  • setup inbound traffic properly for instance's security group

When this is done, just try this command psql -h endpoint -U username -d databasename in you command line so you know you can connect. If it succeeds, you should be able to connect via DataGrip and any other client too.