Our EC2 instance is all set up, but it’s not a proxy yet. We can turn it into a proxy by running the following command with the amazonaws.com address replaced by the server’s DNS name:
$ ssh -R *:5900:localhost:22 -i ~/.ssh/amazon.pem \
> firstname.lastname@example.org -N
The -R option tells the ssh command to create a reverse tunnel (that is, the traffic received by the proxy will be forwarded to the machine that ran the ssh command). The *:5900:localhost:22 argument, which is passed to the -R flag, instructs the command to map port 5900 on the proxy to port 22 on localhost (that is, the computer from which we ran the ssh command). We’ve chosen to use 5900 because it is a common port for tools ...