Skip to content

Instantly share code, notes, and snippets.

@lek890
Created April 20, 2021 09:16
Show Gist options
  • Save lek890/446e82e1c37768d93f57954f0c8b1703 to your computer and use it in GitHub Desktop.
Save lek890/446e82e1c37768d93f57954f0c8b1703 to your computer and use it in GitHub Desktop.
#!/bin/bash
function ssh_jump_aws {
if [[ -z $1 ]]; then
echo "jump hostname required as parameter 1"
return 1
fi
if [[ -z $2 ]]; then
echo "target hostname required as parameter 2"
return 1
fi
local jump_host=$1
local target_host=$2
ssh -o ProxyCommand="ssh -W %h:%p '$jump_host'" "ec2-user@$target_host"
}
ssh_jump_aws $@
#!/bin/bash
function ssh_jump_aws {
if [[ -z $1 ]]; then
echo "jump hostname required as parameter 1"
return 1
fi
if [[ -z $2 ]]; then
echo "target hostname required as parameter 2"
return 1
fi
local jump_host=$1
local target_host=$2
ssh -o ProxyCommand="ssh -W %h:%p '$jump_host'" "ec2-user@$target_host"
}
ssh_jump_aws $@
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment