Skip to content

Instantly share code, notes, and snippets.

@jeongho
Created March 4, 2017 05:11
Show Gist options
  • Save jeongho/cc546951df15f897d44e1e35f39f7660 to your computer and use it in GitHub Desktop.
Save jeongho/cc546951df15f897d44e1e35f39f7660 to your computer and use it in GitHub Desktop.
Configuring a SOCKS Proxy for Amazon EC2
https://www.cloudera.com/documentation/director/latest/topics/director_security_socks.html
Step 1: Set Up a SOCKS Proxy Server with SSH
nohup ssh -i "your-key-file.pem" -CND 8157 ec2-user@instance_running_director_server &
Step 2: Configure Your Browser to Use the Proxy
Setting Up SwitchyOmega on the Google Chrome Browser
proxy autoconfig:
function regExpMatch(url, pattern) {
try { return new RegExp(pattern).test(url); } catch(ex) { return false; }
}
function FindProxyForURL(url, host) {
// Important: replace 172.31 below with the proper prefix for your VPC subnet
if (shExpMatch(url, "*172.31.*")) return "SOCKS5 localhost:8157";
if (shExpMatch(url, "*ec2*.amazonaws.com*")) return 'SOCKS5 localhost:8157';
if (shExpMatch(url, "*.compute.internal*") || shExpMatch(url, "*://compute.internal*")) return 'SOCKS5 localhost:8157';
if (shExpMatch(url, "*ec2.internal*")) return 'SOCKS5 localhost:8157';
return 'DIRECT';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment