amzon ec2 ssh tunnel proxy

How To Create Your Own Private Proxy Using Amazon EC2 and Putty on Windows


Proxies are very useful when you want to surf the internet using another IP address. It lets you browse websites as if you are in a different location.

This is important for internet marketers for testing campaigns and viewing offer sites.

A great practical example is viewing CPA Affiliate offers. Most of them are targeted to specific countries and usually, the ones that are easily profitable are targeted to countries like the US, UK, AU, etc.. But if you’re currently not in any of these countries, you might find it difficult just to preview the offer. And we sure need to take a look at what we’ll be offering, before we start promoting it.

For non-marketers, the need for using proxies may arise if you want to view content which are restricted to certain countries other than where you’re currently in. Like videos or TV shows which are made available only to US or UK visitors.

Or it may simply be out of privacy concerns.

Whatever your purpose is for using an internet proxy, you can either use free public proxy providers or buy premium services from private proxy and VPN providers.

You can just head on to Google and search for the term “free proxy” and you’ll get a list of public proxy providers. But the problem with free proxies is they’re being used by lots of other users simultaneously so your browsing experience may not be very desirable. Speed is greatly decreased and availability is usually intermittent with these providers.

With paid services on the other hand, you can enjoy reliable connections and get to use IP addresses that are exclusive to you.

But another way to get the same reliability and exclusivity and still for free, is by using Amazon Web Services‘ Free tier of their EC2 product.

What we’ll do here is just create a virtual desktop computer on the cloud and use Putty, an SSH client, to connect our local computer to the one on the cloud and route all data traffic to and from our browser via this connection. Effectively, it will be as if we are sitting in front of that virtual computer – wherever it is – and browsing the web from there.

And here’s how to set it up on a Windows PC. If you’re on a Mac or a GNU/Linux system, there’s already lots of guides you can find on Google for you. I just decided to write this guide for Windows users because I had to figure this out myself. It seems like all the geeks conspired to not talk about doing this on Windows.

There are 3 parts to this, the setup on AWS, the setup in Putty on your local computer, and the proxy settings in your browser.

Setting up AWS EC2 Instance

  1. First thing you’ll need is an AWS account. Here is a direct link to the signup page. You can proceed to setup a billing arrangement immediately or do it later.
     
    You’re gonna need a credit card for setting up your billing arrangement, Amazon requires this. But for our purpose, we’ll only be using the Free tier so you won’t actually be charged anything for the whole first year.
     
  2. Go to the AWS Marketplace and search for “ubuntu“. This will be the operating system we’ll install into our virtual desktop, or “instance” as it is called in AWS terms. You can also use other GNU/Linux-based operating systems like Debian, CentOS, etc. but in this example, I’ll be using Ubuntu Server 12.04
     
    ubuntu on AWS marketplace
     
    On the next page, just click the continue button.
     
    ubuntu continue
     
  3. We’ll be using the 1-click launch to keep things simple. To do that, we’ll only need to configure a few settings:
     
    Version – You can leave this unchanged.
     
    Region – Choose from any of the available regions. If you need an IP address from Japan, select Tokyo, if you need an IP address from Europe, select Ireland, etc…
     
    aws ec2 region
     
    EC2 Instance Type – Select Standard Micro (t1.micro) to take advantage of the free tier. This is the only EC2 instance type eligible for the free tier.
     
    aws ec2 instance type
     
    VPC Settings – You can also leave this one in the default.
     
    Security Group – Make sure the seller recommended setting is selected on this one. You should see SSH under the Connection Method column in the description.
     
    aws ec2 security group
     
    Key Pair – If this is your first instance, you’ll be prompted to create a new key pair here. Click the link to go to the EC2 console and create a key pair there. You will only have to provide a name for your key pair and that’s it. Your key file will automatically be prompted for you to download, be sure to save it somewhere convenient, we will use it later.
     
    aws ec2 key pair
     
    When you’re done, come back to this page, hit refresh and you should see the key pair you created as a selection item here.
     
    aws keypair ireland
     
    And you’re all set on AWS! You can now click Launch with 1-Click.
     
    aws ec2 launch instance
     
    A confirmation message should be displayed, saying something like: “An instance of this software is now deploying on EC2.”
     

Setting up Putty

  1. Download Putty here and PuttyGen here. We’ll be needing PuttyGen for converting your keyfile to a format usable in Putty.
     
  2. Now let’s convert the key file you’ve downloaded from step 3 above, when you created a new key pair on AWS EC2. Fire up PuttyGen.
     
    Click Load:
     
    puttygen load
     
    Browse to the folder where you saved the .pem key file you’ve downloaded above. By default, PuttyGen looks for files with the .ppk extension. So be sure to select “All files” here so you’ll be able to find your pem file.
     
    puttygen browse for keyfile
     
    Select your key file from the file browser and click “open”. You should get this confirmation message:
     
    puttygen notice
     
    For the “Type of key to generate”, make sure SSH-2 RSA is selected. Then click “Save private key”. You will be asked if you want to save it without a passphrase. Just proceed without one for the sake of convenience so that you won’t have to type in a password every time you login.
     
    puttygen save private key
     
    Provide a filename and save as a .ppk file. You can then close PuttyGen when you’re done.
     
  3. Now open up Putty and we’ll start setting up your SSH connection to your AWS EC2 instance.
     
    In the Session section:
     
    putty session options
     
    Host Name (or IP Address) – Enter the Public IP of your EC2 instance in this field. You can find the Public IP of your instance by going to your EC2 Management Console, under Instances:
     
    aws ec2 public ip
     
    Port – Enter 22 here.
     
    Connection type – Select SSH.
     
    Saved Sessions – Enter a name for this session by which you can save it for re-use later, so that you won’t have to enter the same settings every time you want to connect to your instance.
     
  4. In Connection >> Data, enter “ubuntu” for the Auto-login username. If you installed a different OS instance than Ubuntu, the username you should enter here may be different also.
     
    putty login username
     
  5. In Connection >> SSH >> Auth section, enter the location of that key file you saved earlier.
     
    putty auth file
     
  6. In Connection >> SSH >> Tunnels section, enter the following then click the “Add” button to add the SSH tunnel you’re going to use.
     
    putty tunnels
     
  7. Go back to the Session section and click “Save” to save your session settings. Then click “Open” to connect to your instance.
     
    putty save open
     
    You will be prompted with a security alert the first time you connect. This is normal, just click Yes to proceed.
     
    putty security alert
     
    When you finally see your command prompt (bash), you’re all set in Putty.
     
    putty command prompt
     
    Notes: You should leave Putty running and connected to your EC2 instance while browsing because all your browsing data goes through Putty.
    And when you want to reconnect later, in the Session section, just click your saved session name and click “Load” to load your settings and then click “Open”.
     

Configuring your browser’s proxy settings

If you’re using Firefox:

  1. Open Firefox’s options dialog. Firefox menu >> Options >> Options
     
    Firefox options
     
  2. In the Advanced >> Network Tab, click Settings.
     
    firefox network settings
     
  3. Choose Manual proxy configuration and enter the following:
     
    firefox connection settings
     
    Click Ok to save you settings and you’re all set! Go to www.whatismyip.com to check your IP. You should see that you’re now browsing the internet using your EC2 Instance’s IP address!

If you’re using Google Chrome:

  1. Go to settings (in the address bar, type: chrome://settings/ ). Scroll down and click “Show advanced settings”. Under Network, click “Change proxy settings...
     
    chrome network settings
     
  2. In the Connections tab, click LAN settings.
     
    chrome connections settings
     
    Then open the advanced proxy settings dialog:
     
    chrome advanced LAN settings
     
  3. Enter the following:
     
    chrome proxy settings
     
    Click Ok on all dialog boxes to save your settings. And you’re all done! Check your IP address on www.whatismyip.com. You should see that you’re now browsing the internet using your EC2 Instance’s IP address!
     

If you’re using Internet Explorer or other browsers:
 
Go get Chrome or Firefox! ๐Ÿ˜€

Wrapping it up

Let me know in the comments below if this works for you. Or if you have questions, also leave them in the comments below and I’ll try to answer them if I’m not sleeping. ๐Ÿ˜€

If you think this guide sucks, please let me know why you think so and I’ll give you a full round-house kick! nahh.. just a slap! hahah!

Seriously, please share if you have a better way of doing this and you’ll help make the world a better place. :)

Nimrod

People don't really know what they want until they learn about it. Marketing educates people about what they want. I'm a marketer, therefore I'm an educator.
Menu