Creating a Proxy using Amazon EC2

With Amazon Web Services EC2 instances it is possible to create virtualized instances which can be configured cheaply to provide services.

Here I will describe how to configure EC2 to create a Proxy.

  1. Navigate to the EC2 console by following https://console.aws.amazon.com/ec2 You will need to logon your AWS account. If you have not got account create one. It’s free!
  2. Once you’ve logged Create a Key Pair by selecting ‘Key Pairs’ which is near the bottom of the menu on the left.
  • Select ‘Create a Key pair’,
  • enter a name and save the file onto your local file system.
  • Change the permission using chmod  to make it read only (chmod 400 <filename>
  1. Create a new Elastic IP Address, again selecting an option on the left hand menu
  2. Launch a new Instance. Just use something from the free tier for now. I usually use Amazon Linux AMI because it is the first on the list 😉
  3. Once selected, press the ‘Next’ Button in the bottom right hand corner. We need to configure things a bit before we launch.
  4. Keep Pressing Next until you get to Step 6.  Change the Configuration to ‘Basic’ as we’ll need outbound access as well.
  5. Launch the Instance using the Key Pair generated earlier.
  6. Wait a few minutes for the instance to go live
  7. Associate your instance to the previously create Elastic IP Address
  8. Press the ‘Connect’ button and follow the instructions to connect. If you have previously connected using the same Elastic IP address you will need to remove the entry in the .ssh/known_hosts file. (If you’re not connecting to anything else using SSH you can just remove the known_hosts file as this will be regenerated).
  9. Once connected, you will need to install Squid. This will depend on the flavour of VM you are using. For the Amazon Linux AMI you can use ‘yum’.
  • yum update
  • yum install squid
  1. Once installed edit the /etc/squid/squid.conf to allow access from all machines. The configuration I am suggesting should be changed but I am using it initally to get things working. The conf file can be editted with:
  • Commenting out #http_access allow manager localhost
  • Adding http_access allow all
  • Keep http_access deny as it is
  1. Start squid. This will depend on your OS again but for the Amazon Linux I used serve start squid.
  2. That’s it! You can configure you browser to use the proxy which should be listening on 3128 using your Elastic IP Address.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s