I've created an Amazon EC2 AMI running CentOS Linux 5.5 and PostgreSQL 8.4. I'd like to be able to create an SSH tunnel from my machine to the instance so I can connect to the PostgreSQL database from my development machine (JDBC, Tomcat, etc.) I haven't modified t开发者_JAVA百科he PostgreSQL configuration at all as of yet. I can successfully SSH into the instance from a command line, and have run the following command to try and create my tunnel:
ssh -N -L2345:<My instance DNS>:5432 -i <keypair> root@<My instance DNS>
I don't receive any errors when initially running this command. However, when I try and use psql to open up a connection on localhost:2345, the connection fails.
Any thoughts as to why this is happening?
The first <My instance DNS>
should be localhost
. And you probably don't want to/need to ssh as root.
精彩评论