Skip to content

Instantly share code, notes, and snippets.

@dliggat
Last active October 18, 2016 19:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dliggat/0d62ace969419af64cb8dd55e73954f4 to your computer and use it in GitHub Desktop.
Save dliggat/0d62ace969419af64cb8dd55e73954f4 to your computer and use it in GitHub Desktop.
SSH into a private subnet via a bastion host
Host buildserver # bastion
HostName 50.123.123.123
User ec2-user
ForwardAgent yes
IdentityFile /Users/dliggat/.ssh/key.pem
Host buildagent # tunnel ssh through a bastion
HostName 10.0.0.100
User ec2-user
IdentityFile /Users/dliggat/.ssh/key.pem
ProxyCommand ssh buildserver -W %h:%p
StrictHostKeyChecking no
LocalForward 127.0.0.1:8080 10.0.0.100:8080
Host buildagentweb # forward port 8080 to access web
HostName 50.123.123.123
User ec2-user
IdentityFile /Users/dliggat/.ssh/key.pem
StrictHostKeyChecking no
LocalForward 127.0.0.1:8080 10.0.0.100:8080
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment