Creating Your Own Secure Proxy Server on the Cloud

Establish a Secure Gateway to the Internet with Your Cloud-Based Proxy Server

Prabir Kalwani
4 min readNov 26, 2023

Introduction

Have you ever faced the frustration of trying to access a website, only to find it blocked on your college or office Wi-Fi? I know the feeling all too well. But fear not, because I’ve got a solution that will blow your mind — building your own proxy server on the cloud!

Navigate to the steps by clicking here.

This idea struck me while I was preparing for my end-semester exams and couldn’t afford to waste time on blocked websites. In this article, I’ll be your guide on how to create your very own proxy server that will help you bypass any pesky website blocks and enjoy unrestricted internet access. Excited yet? Let’s get started!

So For Those Who Don’t Know what is a Proxy Server ?
A proxy server acts as a bridge between a user’s device and the internet, serving various purposes depending on the user’s needs, such as enhancing privacy, accessing geo-restricted content, optimising network performance, bypassing content filters, and facilitating secure remote access, making it a versatile tool for digital empowerment. So now lets see how to make it

Proxy Server Description
Proxy Server Acts Like an Intermediate

Getting Started

As physical servers can be expensive, it’s not a necessity to own one. Cloud services like AWS, Azure, and GCP offer a great alternative. You can use a free-tier server with good bandwidth and still get the job done. In this example, I’ll be using AWS EC2, which has budget-friendly options to create a proxy server that’s both cost-effective and powerful.

Let’s dive into how we can leverage AWS EC2 to build a server that not only protects your online activities but also fits within your budget.

For This Fire up your AWS Console and go EC2 ( Elastic Compute)

  • Initiate a new AWS Instance.
  • Select Ubuntu as your preferred operating system.
  • Opt for a key pair login for enhanced security.
  • Configure the instance with a basic amount of storage.
  • And then Launch Your Instance

Now Connect to your instance using SSH and run the following Maintaince Commands

Sudo apt upgrade 
Sudo apt update

Most Linux Distro’s Come with SSH installed … We will be leveraging this for our proxy server by using something called SSH tunnel.

Now, An SSH Tunnel also known as an SSH port forwarding, is a secure way to establish a connection between a local and a remote computer through an encrypted channel. Basically A connection to our Proxy Server.

The Process

  1. So Lets write a command to connect to our instance
    Open Up Your Terminal and Run
ssh -i  "[PATH OF YOUR KEY ]" -D 1369 -N -C ubuntu@[YOUR PUBLIC IP]

To Better Understand this we can break down

  • ssh -i ”[PATH OF YOUR KEY]” :- This option specifies the path to the private key file used for authentication
  • D 1369 :- This option enables dynamic port forwarding. It opens a local port (1369 in this case) and sets up a SOCKS proxy on that port.
  • -N :- This option tells SSH not to execute any commands on the remote server
  • -C :- This option enables compression during data transfer.
  • ubuntu@[YOUR PUBLIC IP] :- This specifies the username (ubuntu in this case) and the public IP address of the remote server you want to connect to

Optional Step

We Can Save Us Some Time whenever we write this command by adding the following to our ssh config file :-

Host VPN
Hostname <YOUR IP>
User ubuntu
IdentityFile <YOUR FILEPATH>
DynamicForward 1369
RequestTTY no
Compression yes
ExitOnForwardFailure yes
LogLevel ERROR

You can now run this by the following command :-

ssh VPN -N

Now We have Successfully Established a connection to Our Server

For a more beginner-friendly approach, we’ll integrate this proxy with our web browser instead of applying it globally. So Fire up your web browser , Im going to be using Firefox for this demo

Now i will open up my firefox settings and search for proxy setting then a pop like the one shown here will open :-

Firefox > Settings > Network Settings > Configure how firefox connects to the internet

After this select Manual Proxy Configuration and in the SOCKS Host put in localhost 1369 as your configuration as shown in the image above and thats it your proxy is setup .

You Can Refer this quick Demonstration To understand more about it :-

video showing to make it work

Conclusion

In this blog post, we have discussed how to establish a secure gateway to the internet with your cloud-based proxy server.
We have covered the basics of proxy servers, why you might want to use one, and how to set one up using AWS EC2 and Firefox.And We have also seen a video demonstration of the process.

Thank you for taking the time to read this guide on setting up your own cloud-based proxy server.All the References for the technologies used above are given below.

Feel free to reach out to me if you have any queries/Suggestions

References:

--

--

Prabir Kalwani

Curious scholar pursuing Tech and MBA. Committed to innovation, sustainability, adept in advanced web tech like ReactJS, MERN, MEAN.