Skip to content

Instantly share code, notes, and snippets.

@Japh
Created November 24, 2015 04:49
Show Gist options
  • Save Japh/63b4a53883d68c648e77 to your computer and use it in GitHub Desktop.
Save Japh/63b4a53883d68c648e77 to your computer and use it in GitHub Desktop.
Spinnaker tunnelling
#!/bin/bash
socket=$HOME/.ssh/spinnaker-tunnel.ctl
if [ ! \( -e ${socket} \) ]; then
echo "Opening tunnel to Spinnaker..."
ssh -f -N spinnaker-start && echo "Tunnel open."
else
echo "Closing tunnel to Spinnaker..."
ssh -O "exit" spinnaker-stop && echo "Tunnel closed."
fi
Host spinnaker-start
HostName <hostname-here>
IdentityFile <path-to-keypair-here>
ControlMaster yes
ControlPath ~/.ssh/spinnaker-tunnel.ctl
RequestTTY no
LocalForward 9000 127.0.0.1:9000
LocalForward 8084 127.0.0.1:8084
LocalForward 8087 127.0.0.1:8087
User ubuntu
Host spinnaker-stop
HostName <hostname-here>
IdentityFile <path-to-keypair-here>
ControlPath ~/.ssh/spinnaker-tunnel.ctl
RequestTTY no
@Japh
Copy link
Author

Japh commented Nov 24, 2015

Using the entries above in my ~/.ssh/config, and the bash script, I can just run ./spinnaker-tunnel.sh and toggle whether I'm connected to the AWS instance to use Deck in my browser. Simples!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment