Skip to content

Instantly share code, notes, and snippets.

@shiumachi
Created August 15, 2017 04:39
Show Gist options
  • Save shiumachi/9dac718cdcc5df3ccd5874a05a745cb1 to your computer and use it in GitHub Desktop.
Save shiumachi/9dac718cdcc5df3ccd5874a05a745cb1 to your computer and use it in GitHub Desktop.
指定したAWSインスタンスに対するSOCKSプロキシを構築するコマンドを取得する
PROFILE=your_profile
INSTANCE_NAME=your_instance_name
SSH_KEYPATH=your_ssh_key_path
PUBLIC_HOSTNAME=`aws --profile ${PROFILE} ec2 describe-instances | jq -r ".Reservations[] | select(.Instances[0].Tags[].Value == \"${INSTANCE_NAME}\") | .Instances[0] | .PublicDnsName"`
echo "establish SOCKS proxy"
echo "ssh -i ${SSH_KEYPATH} -D 8157 -q ec2-user@${PUBLIC_HOSTNAME}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment