Last active
April 13, 2017 08:56
-
-
Save pshoukry/5c1a2b8513b0f9c1edf5a2e54c620932 to your computer and use it in GitHub Desktop.
SSH-Tunnel to mysql ( RDS or normal mysql instance) from rails application
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Host intermediate | |
User <myuser> | |
HostName intermediate.domain.com | |
ForwardAgent yes | |
Host frontend | |
User <myuser> | |
ProxyCommand ssh intermediate nc <frontend_ip> 22 | |
Localforward 3307 mysql.domain.com:3306 | |
ForwardAgent yes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM buildpack-deps:jessie | |
ADD . /root/.ssh | |
RUN chown -R root:root /root/.ssh | |
RUN apt-get update | |
RUN apt-get install -y mysql-client socat | |
expose 3306 | |
CMD socat tcp-l:3306,fork,reuseaddr tcp:127.0.0.1:3307 & ssh -N frontend |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment