Skip to main content
Added example for using SCP
Source Link
z0r
  • 295
  • 2
  • 8

I've added these aliases to my .bashrc file:

alias ssh-foo='ssh -o ProxyCommand="ssh -W %h:%p -l ubuntu <FOO_BASTION_IP>" -l ubuntu'
alias ssh-bar='ssh -o ProxyCommand="ssh -W %h:%p -l ubuntu <BAR_BASTION_IP>" -l ubuntu'

Now the command to connect is as simple as:

ssh-foo <FOO_INSTANCE_IP>

The alias for scp is similar but the user name needs to be given differently:

alias scp-bar='scp -o ProxyCommand="ssh -W %h:%p -l ubuntu <BAR_BASTION_IP>" -o User=ubuntu'

I've added these aliases to my .bashrc file:

alias ssh-foo='ssh -o ProxyCommand="ssh -W %h:%p -l ubuntu <FOO_BASTION_IP>" -l ubuntu'
alias ssh-bar='ssh -o ProxyCommand="ssh -W %h:%p -l ubuntu <BAR_BASTION_IP>" -l ubuntu'

Now the command to connect is as simple as:

ssh-foo <FOO_INSTANCE_IP>

I've added these aliases to my .bashrc file:

alias ssh-foo='ssh -o ProxyCommand="ssh -W %h:%p -l ubuntu <FOO_BASTION_IP>" -l ubuntu'
alias ssh-bar='ssh -o ProxyCommand="ssh -W %h:%p -l ubuntu <BAR_BASTION_IP>" -l ubuntu'

Now the command to connect is as simple as:

ssh-foo <FOO_INSTANCE_IP>

The alias for scp is similar but the user name needs to be given differently:

alias scp-bar='scp -o ProxyCommand="ssh -W %h:%p -l ubuntu <BAR_BASTION_IP>" -o User=ubuntu'
Source Link
z0r
  • 295
  • 2
  • 8

I've added these aliases to my .bashrc file:

alias ssh-foo='ssh -o ProxyCommand="ssh -W %h:%p -l ubuntu <FOO_BASTION_IP>" -l ubuntu'
alias ssh-bar='ssh -o ProxyCommand="ssh -W %h:%p -l ubuntu <BAR_BASTION_IP>" -l ubuntu'

Now the command to connect is as simple as:

ssh-foo <FOO_INSTANCE_IP>