mikelovelyuk
mikelovelyuk

Reputation: 4152

AWS Connecting to Postgres Not Working

I am very new to AWS/Elastic Beanstalk/RDS but I can't figure out why I am unable to connect to my Postgres DB via Postico.

As far as I can tell, I am entering the correct credentials found under "Environment Properties" in the AWS dashboard.

When I run psql statements from the terminal (ssh'd in here as "ec2-user@ip-*****") it says "command not found". But my site is actually up and working. And according to the RDS tab on AWS it is definitely using Postgres.

When I try and connect using Postico (not via SSH), it just hangs for ages and then times out. No error! I'm using the same user, password, and host names stored in the "Environment Properties". I'm even using port 5432.

What can I try?

Upvotes: 2

Views: 6575

Answers (1)

Vorsprung
Vorsprung

Reputation: 34327

  1. Go to the RDS Dashboard
  2. select 'DB Instances'
  3. click the toggle in the LH column under "filter" next to database you wish to attach to
  4. Copy the "Endpoint" setting ie postgres-db.ba2syxhcyfxx.eu-west-1.rds.amazonaws.com:5678
  5. on your EC2 shell as root issue command yum install postgresql
  6. in your shell on an EC2 issue command psql -h postgres-db.ba2syxhcyfxx.eu-west-1.rds.amazonaws.com -p 5678 -U myuser

Where "myuser" is the user you wish to attach as

Upvotes: 4

Related Questions