Skip to content

Instantly share code, notes, and snippets.

@burdandrei
Created June 24, 2015 08:21
Show Gist options
  • Save burdandrei/6a1cd5fe4aba5f0824a7 to your computer and use it in GitHub Desktop.
Save burdandrei/6a1cd5fe4aba5f0824a7 to your computer and use it in GitHub Desktop.
Example of forwarding remote port to localhost (Connecting to DB behind the firewall through the SSH Tunnel)
#!/usr/bin/env bash
REMOTE_HOST=ip-10-2-10-197.ec2.internal # Related to PROXY_HOST
REMOTE_PORT=27017
LOCAL_PORT=27017
PROXY_HOST=ec2-55-210-99-165.compute-1.amazonaws.com
ssh -f -L ${LOCAL_PORT}:${REMOTE_HOST}:${REMOTE_PORT} $PROXY_HOST -N
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment