Host a Website on AWS for Free in 5 Minutes

Hey there, If you want to host a website on AWS, you have landed at the right place. I have hosted several AWS websites like IT Panther, AI Tools, Infobloomer, QuickBotify, etc.

Why should you host your website on AWS?

There are several reasons to host your website on AWS rather than other hosting providers which lack in giving you full control of your server. Let me list down a few:

  1. AWS is one of the biggest cloud providers and has anywhere between 30 to 40% of the market share and growing.
  2. AWS provides many Virtual Servers (also known as EC2 instances) that come under the free tier. We can utilize these services to run our website for free or at extremely low cost.
  3. AWS provides special credits if you are a Startup. At the time of me writing this article, AWS is giving 100,000$ worth of AWS resources for free to eligible startups.
  4. In this tutorial, we are going to use “t2.micro” EC2 instance which is eligible for 750 hours of monthly free run.

Creating an EC2 Instance

Let’s start with creating an EC2 instance. I am going to launch an EC2 instance in the “us-east-1” region. Here is the direct link to jump to launch an EC2 instance.

Name: Give a suitable name to the EC2 Instance. I am naming it “web-hosting”
Application and OS Images (Amazon Machine Image): Select “Amazon Linux 2023 AMI” or any other suitable AMI based on your liking.
Architecture: Let’s keep it to “64-bit (x86).
Instance type: t2.micro (this is eligible for Free tier)
Key pair (login): Create a new key pair or select the existing key pair.

Network settings:

  • Select Allow SSH traffic from anywhere.
  • Select Allow HTTPS traffic from the internet.
  • Select Allow HTTP traffic from the internet

Storage: I am creating this instance only for the demo purpose, so i am keeping it 8GB, but please feel free to change the storage size to what’s suitable for your website.

That’s it, we are pretty much done with the configuration and we can now hit “Launch Instance”. AWS is going to take a few seconds before our instances show in the running state.

Login to EC2 and Install HTTPD

Login to the EC2 instance, we can do that by using the following command “ssh -i /path/to/your/private/key ec2-user@<public-ip-address-of-ec2>”

We can install “httpd” on amazon linux by using the below command.

sudo yum install -y httpd
sudo systemctl enable httpd
sudo systemctl start httpd

Copy your website to /var/www/html/ directory

After successfully running the Web Server, I am going to download an HTML template from this website. We can use wget command for that as shown below. Please note in your scenario, you would need to copy your website’s project directory the the /var/www/html/ directory.

mv inance/* /var/www/html/

Launch your website

We can now copy the public IP address of our EC2 instance and paste it on the browser, Hit Enter, and your website should magically show.

Update “A Record” in Domain Registrar

You would not like people to remember the IP address to visit your website. So you would need to add the Public IP address of the EC2 website in the domain name registrar. If you already have a domain name available then, go to “DNS Settings” and add an A Record, by adding the EC2 instance IP address in the value field. Here is what it looks like in the Cloudflare DNS Record.

Video Tutorial

You can watch the step by step tutorial on my Youtube channel.

Scroll to Top