Skip to content

Instantly share code, notes, and snippets.

@cmackenzie1
Created August 13, 2019 21:13
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cmackenzie1/aeac193a87d135c852373980cd02d393 to your computer and use it in GitHub Desktop.
Save cmackenzie1/aeac193a87d135c852373980cd02d393 to your computer and use it in GitHub Desktop.
SSH Tunnel / Bastion Hop config example
Host *
AddKeysToAgent yes
UseKeychain yes
IdentityFile ~/.ssh/id_rsa
# Helps prevent timeout of connections due to inactivity
ServerAliveInterval 30
TCPKeepAlive yes
# Use key forwarding so I don't have to put my private key on the servers
ForwardAgent yes
Host bastion
Hostname bastion.example.com
User ec2-user
IdentityFile ~/.ssh/id_rsa
ProxyCommand none
ForwardAgent yes
Host instance1
Hostname instance1.vpc.internal
User ec2-user
IdentityFile ~/.ssh/id_rsa
ProxyCommand ssh bastion -W %h:%p
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment