Rishabh Verma
Posted on June 28, 2024
How to Host Your Website for Just $0.50!
Do you want to host your website for just $0.50? You heard me right! It’s not clickbait—just keep reading.
I’m in my final year, and I have a dream of building my own portfolio website. However, there’s a significant hurdle: hosting a website is expensive. If you check out GoDaddy’s prices, you’ll be shocked
Determined to find a more affordable solution, I started researching alternatives. And guess what? I found an incredible workaround.
Note: The actual cost may vary slightly based on usage, but it’s still incredibly affordable compared to traditional hosting options.
Here’s the Plan:
We use an AWS Free Tier account, which provides dozens of services for free. Our website content is stored in an S3 bucket, which is a storage service (also free). This way, you only pay for DNS (Route 53).
So Let's Get Started:
Steps:
- Create an AWS Account
- Buy a domain from any domain site like GoDaddy
- Upload your website content to S3
- Point your domain name to the S3 bucket via CloudFront
- Enjoy your website :)
Step 1: Creating an AWS Account
Type "AWS Console" in your browser.
Now create your account (you can do it! It’s easy). Remember, you have to provide your payment method before you can use AWS services, even though the services we’re using are free or very low cost.
Step 2: Buying a Domain
Buy a domain from your favorite domain registrar. I chose GoDaddy But you can choose any registrar you like.
Step 3: Uploading Content to AWS S3
Once you open the AWS Console, type "S3" in the search bar.
Click on Buckets.
Give your bucket a unique name.
To allow users to access your website, uncheck all public access restrictions.
Inside your bucket, click on the Upload button to upload your website content.
Before uploading your website files to AWS, ensure that your main file, like index.html
, is directly visible and not inside a folder. For example, if your website files are in a folder named "my website," upload the files inside it, not the whole folder. Otherwise, AWS won’t be able to find the index.html
to display your website.
Next, we need to enable static web hosting to turn your bucket into a basic web server for serving HTML, CSS, JavaScript, and images.
Go to Properties.
Click on Edit.
Fill in the options as shown below:
Click on the Bucket website endpoint to check if your website is visible.
If it’s not, don’t worry! Head over to the Permissions tab.
Scroll down to find the Bucket Policy.
Here’s where we’ll add a policy to make your content publicly accessible. You can use the following policy snippet:
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "PublicReadGetObject",
"Effect": "Allow",
"Principal": "*",
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::your-bucket-name/*"
}
]
}
Replace your-bucket-name
with the actual name of your S3 bucket. This policy allows anyone to read (download) objects from your bucket, which is necessary for public web access.
Step 4: Pointing Your Domain to the S3 Bucket via Route 53
To make your domain point to your S3 bucket, use Route 53
Here’s a step-by-step guide
Create a Hosted Zone in Route 53: For your domain to manage DNS settings.
Add DNS Records: Set up the necessary DNS records (usually A or CNAME records) in Route 53 that point to your S3 bucket. Remember Route charge 0.50$ for each A record ( so be careful).
Update Name Servers: If your domain is registered with another provider, update the name servers to those provided by Route 53.
Step 5: Enjoy Your Website!
You’re all set! Your website should now be live and accessible via your custom domain. Hosting for just $0.50? Mission accomplished!
If you are facing any issues, just write in the comments, and I will help you.
Posted on June 28, 2024
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.