Hosting a site with the help of AWS for free using Windows

Rishabh Rai
7 min readMay 8, 2023

--

Today I will be showing you, one way of hosting a site on AWS without paying any money(if you are okay to use less resource, potentially a portfolio can be uploaded like this)

In college we were asked to make a project for which we were required to host a site, and to do that without paying any money and save it to eat in canteen, we started brainstorming ideas. From there this idea came into play so I started exploring it.

Problem: Now, firstly i had all the backend and frontend ready but the issue was to host it and make it available to others.

Solution: The friend who was working on the backend wanted to connect to a windows machine with GUI obviously. To work with all the databases and coding.

So, I launched a free tier windows machine like this:

Login to your AWS account. And come to the instances page as shown.

Then click on the Launch Instance button.

After doing that you should be able to see something like this:

Type in the web server name
i wanted a windows instance

Select your required OS, I have choosen windows here. And the free tier eligible machine will be there by default, don’t touch If you don’t want to look like this with your AWS account.

Now moving forward on the next stage we have to get a key. Private Keys if you are not familiar with them. Then do check this BLOG.

Select your key name and then choose the files accordingly to what you are using to connect, I would suggest to have them both. You never know what can be needed at any time.

After setting up the keys to connect, Hit on Create key pair.

We will now change the network settings to make it accessible through http:// and https:// types of request meaning we are opening inbound and outbound traffic on 80, 443 ports.

Hit on launch instance. To finalize the instance and run it.

You should be able to see something like this on your instances page, this means your instance is running and ready to connect.

You should have something like this when you click on the instance

After clicking on the instance, hit on the connect button on the top right section.

Since, I am going for the GUI connection hence i chose RDP connection here.

Download the remote desktop file

To connect using RDP to the instance created we will have to know these things:
IP
USERNAME
PASSWORD

We already have the IP. And for the username it is mainly administrator account given by aws for you to have full control of the instance.

username : Administrator

Now click on the Get Password button, then it will give you the option to paste the private key which will be decrypted for you to have the password of the instance.

Upload the content or the private key whose name is written. (here, tr3nt_ssh) (I asked you to download it earlier!! remember)

Click on decrypt password to get the pass

Now we have IP, Username and Password. We are ready to connect.

Let’s go and fire up Remote Desktop (Microsoft Store)

Click on the Add Button to add a new PC.

Type the IP address in PC name and click on the + button shown.

Fill the details in this prompt. Password is optional

You should see something like this on the Remote Desktop dashboard, without the wallpaper if you haven’t connected once.

You, will be prompted here to put any password if you haven’t given the password while making the account. Type in the password and you should be given the permission to log in.

We have now logged in on the machine which we have created.

To setup the Apache server on windows i tried installing the apache haus on the windows. But I got confused because it was not working properly and I thought that this won’t work out.

On the next day, After some research I found a site https://www.liquidweb.com/kb/how-to-install-apache-on-a-windows-server/

Which was helpful and with the help of the article I found what was missing, One file and other is the firewall rule to allow incoming traffic. So let’s get working.

The first the article tells is to download the Visual C++ 2008 Redistributable Package. Now the problem was that already a older version was present so I went and searched for “add or remove program” in the start menu. Then i uninstalled the older version.

After that i ran the exe file and it downloaded the latest version.

But a lot of work is still pending. Let’s get to that:

After doing all this if you run the httpd.exe file then you will be able to access the server on localhost.

But my goal is to make it publicly available, so let us move forward:

INSTALLING APACHE SERVICE

All we have to do is run a simple command:

httpd.exe -k install -n “Apache HTTP Server”

You might get something like this

no need to take tension of the error

you can configure the httpd.conf to change the configuration and remove the error. (but right now we are focusing on hosting the simple web site)

In the next step you have to run this command to open a services window:

I have already started it

You have to double click or you can start it from the left side of the window.

After starting the service restart it once or whenever required.

CONFIGURING THE FIREWALL

Type “firewall” in the windows search bar and then click on “Windows Defender Firewall with Advanced Security”

Go to Inbound rules and then click on new rule

Then you will be prompted a window to choose the rule type > select ports
Then click on protocol and ports > select TCP protocol and 80,443,8080 ports
Click on next and choose Allowtraffic in action

Then click on next until you reach the name and description part
Type a relevant name which you can remember and a description about it

Type the name and hit on finish.

This should come as a result:

All of the work is done now Only thing left is to connect to the server using the public IP.

The site is hosted though it is not secure right now, But we will do all the certification some other time.

Now you can disconnect the rdp session and everything will be on and working properly fine.

You can create html css files to change how the web page looks.

Get creative and make host your websites for free on aws.

be creative if you want this award

HAPPY LEARNING 🎭🤓……

Join me on various platforms to discuss Cybersecurity and Cloud-related topics. From security best practices to cloud infrastructure, let’s exchange ideas and insights and stay ahead of the curve..

CONNECT WITH ME 🔗💻

--

--

Rishabh Rai

4th year student exploring the world of cyber security with a knack for writing and always learning.