Start a new topic

Using SSH Tunnel to connect to Amazon RDS (mysql)

[This topic is migrated from our old forums. The original author name has been removed]

Hi, I have been trying to connect to my RDS using EC2 as a jumping board. But the tunnel section doesn't work, however, using ssh -L 3307:rds-location:3306 username@aws-ec2 works. Has anyone else suceeded?

[This reply is migrated from our old forums.]

Re: Using SSH Tunnel to connect to Amazon RDS (mysql)
Hi Levi, We have customers connecting to remote MySQL databases running on the Amazon service. The SSH Tunnel section fields correspond to the ssh command options like this: ssh -p -L:: @ Note that when using an SSH tunnel, the Database Server is evaluated on the SSH host. If the database server is running on the SSH host, you can therefore set Database Server to localhost in case the database only accepts local connections. If this doesn't help, please post/send a screenshot of your Connection tab and the error message you get. Best Regards, Hans
[This reply is migrated from our old forums. The original author name has been removed]

Re: Using SSH Tunnel to connect to Amazon RDS (mysql)
Hi Hans: Forgot to mention, there is a key file I use as well. This is what I have set up so far that doesn't work: Database Server: amazons.long.domain.for.RDS.com Database: the.database.I.want.to.connect.to DatabaseUserId: username.to.the.database Database Password: password.to.the.database SSH Host: domain.to.the.EC2 SSH Port: 22 SSH UserId: username.on.the se Private Key File: ec2 This is what I get back: Product: DbVisualizer Personal 8.0.9 Build: #1751 (2012/04/30 11:38) Java VM: Java HotSpot(TM) 64-Bit Server VM Java Version: 1.6.0_33 Java Vendor: Sun Microsystems Inc. OS Name: Linux OS Arch: amd64 OS Version: 3.2.12-gentoo An error occurred while establishing the connection: Long Message: Communications link failure The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server. Details:    Type: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException    SQL State: 08S01
[This reply is migrated from our old forums.]

Re: Using SSH Tunnel to connect to Amazon RDS (mysql)
Hi Levi, A couple of notes: You say that you specify Database Server as "amazons.long.domain.for.RDS.com". Have you tested with just "localhost" instead? It may sound strange, but the way SSH works, it is evaluated on the remote host and typically MySQL listens only on connections made from "localhost" so it has to be set that way. SSH Host should probably be set to "amazons.long.domain.for.RDS.com" instead. For Private Key File, you say you specify "ec2". This should be the file path for the file that contains the private key. Please try with these changes and let us know how it goes. Best Regards, Hans
[This reply is migrated from our old forums. The original author name has been removed]

Re: Using SSH Tunnel to connect to Amazon RDS (mysql)
Hi Hans: I am using an ec2 server to access the mysql server, reason for this is the rds domain for the RDS (mysql server) isn't accessible from the outside. I did find out the problem, for some reason the really long domain name was the issue, when I changed it to the ip it worked. Also, if I set rds to the ip in the /etc/hosts file on the ec2 it also works. Question, is there a length limitation in dbvis?
[This reply is migrated from our old forums.]

Re: Using SSH Tunnel to connect to Amazon RDS (mysql)
Hi Levi, We're using a third party component for SSH, but I doubt that it has any length limitations for the domain name. Are you sure that the domain name you supplied really matches the IP you use successfully when translated by your regular DNS server rather than via your /etc/hosts file? Either way, I'm glad you found a way to connect. Best Regards, Hans
[This reply is migrated from our old forums. The original author name has been removed]

Re: Using SSH Tunnel to connect to Amazon RDS (mysql)
I had exactly the same problem with dbvis 9.1.3 and using the IP fixed it. The hostname is correct as I can ssh to my EC2 and then do mysql -h xxxxxx -u xxxxx -p and it connects fine. Maybe you should mark this as a bug and investigate it?
[This reply is migrated from our old forums.]

Re: Using SSH Tunnel to connect to Amazon RDS (mysql)
Hi, We are looking into what may be causing this. The tunnel is established correctly, but network errors occur for some reason when trying to establish a JDBC connection through it. I'll try to get to the bottom with it. Best Regards, Hans
[This reply is migrated from our old forums. The original author name has been removed]

Re: Using SSH Tunnel to connect to Amazon RDS (mysql)
Hy Hans, do you have any update on this? I am using dbvisualizer with the integrated ssh tunneling on several servers, but I have the same issues on amazon RDS... it works fine when opening the tunnel externally using ssh, but the integrated ssh tunnel does not work at all (either using the ip instead of the hostname or trying different configurations).
[This reply is migrated from our old forums.]

Re: Using SSH Tunnel to connect to Amazon RDS (mysql)
Hi, We are working with the developer of the SSH software on the long hostname issue. They have fixed one issue in this area in a version later than the one bundled with the current DbVisualizer, but unfortunately there seems to be other issues even in that version. Hopefully we will find a solution together with them soon. The issue with long hostnames can be worked around using the IP address instead, so if that doesn't work for you it is probably some other issue. Please tell us a bit more and include the debug log produced when you try to connect after enabling debugging for DbVisualizer in Tools->Debug Window. Best Regards, Hans
[This reply is migrated from our old forums.]

Re: Using SSH Tunnel to connect to Amazon RDS (mysql)
Hi, Just wanted to let you know this is now fixed in the just released 9.1.11 version. Regards Roger
[This reply is migrated from our old forums. The original author name has been removed]

Re: Using SSH Tunnel to connect to Amazon RDS (mysql)
I don't think this is fixed. Just tried it out and needed to use the IP
[This reply is migrated from our old forums.]

Re: Using SSH Tunnel to connect to Amazon RDS (mysql)
Hi William, Which DbVisualizer version are you using? Please open Tools->Debug Window and enable debugging for DbVisualizer. Then perform try to connect again and include the debug output in your reply. Best Regards, Hans