I created Amazon EC2 AMI running on CentOS Linux 5.5 and PostgreSQL 8.4. I would like to be able to create an SSH tunnel from my machine to an instance so that I can connect to the PostgreSQL database from my development machine (JDBC, Tomcat, etc.). I have not modified the configuration of PostgreSQL at all though. I can successfully SSH into the instance from the command line and run the following command to try to create my tunnel:
ssh -N -L2345:<My instance DNS>:5432 -i <keypair> root@ <My instance DNS>
I get no errors when I run this command for the first time. However, when I try to use psql to open a connection on localhost: 2345, the connection fails.
Any thoughts on why this is happening?
source share