Ssh tunnel
<DRAFT>
Create SSH tunnel (for example to access remote mysql database which listening only locally)
We get remote port 3306 to be able /listen locally on 3307
ssh -p <remote_ssh_port_number> -L 3307:127.0.0.1:3306 <user_name>@<serverIP>
For example:
ssh -p 22 -L 3307:127.0.0.1:3306 root@1.2.3.4
Optionally You may want to add thise into server boot. foopr example add the next line into /etc/rc.local:
/bin/screen -d -m -S ssh_tunnel_to_production_srv /bin/ssh -p 4582 -L 3307:127.0.0.1:3306 root@1.2.3.4
EXAMPLE: Connect to your database via jump host or also could be called bastion host . Like establish tunnel to AWS RDS in private VPC via bastioon host:
ssh -i .\private.key -N -L 3306:somedatabase.xxxxyyyyzzzz.eu-central-1.rds.amazonaws.com:3306 linux_user@1.2.3.4 (1.2.3.4= bastion host ip)
after that you should be able to connect to your RDS db using localhost ip