Hosting your own website in AWS

Why use AWS?

You might be asking the question, why would I use AWS when there are easier options like Github Pages, Substack, Medium, or whatever of the 100's of options there are out there. The answer? I dont really have one, I just personally wanted to host my site there cause I like messing around in AWS - plus it gives me a little more control (just make sure you don't enable random things and run your bill up).

Getting started

There a plenty of ways you could probably build a site, I chose to use Jekyll a super simple website generator you can setup within minutes. Unfortunately you are gonna have to read the docs (I know its devastating) to install Ruby on your computer. After that we can run the following commands to get up and running with a local site


    # Install the Jekyll and bundler gems
    gem install jekyll bundler

    # Create a new Jekyll site 
    # Change 'website' to whatever you want
    jekyll new website

    # Change directory after your site is created
    cd website

    # Build the site and make available locally
    bundle exec jekyll serve

    In your browser navigate to http://127.0.0.1:4000
    

We can now begin creating our website, blog, marketplace, pretty much anything you want.

Setting up AWS

The setup for AWS is rather straight forward, since we are creating a static (a site that delivers pre-built content) its really only a few short steps before you have a functioning page people can navigate to.

First if you dont have one already - create an AWS account. You'll initially be logged into the root user (the super user with unrestriced privileges), its good security practice to not use this account for daily activities so we will create a new power user to use, I'm not going to go through those exact steps if you need assistance AWS has a large documentation library that can be referenced - Create an IAM user in your AWS account.

S3 Setup

Serving a static website is very straight forward in AWS, start with creating an S3 bucket. Name it whatever you want, and make sure to uncheck the "Block Public Access" (you need to uncheck this otherwise your site wont work), you can then hitCreate Bucket

At this point you can upload the "_post" folder from your Jekyll site (dont upload the entire Jekyll folder, you only need the _post folder to get a working website). In your S3 bucket, go to Properties and Enable "S3 static website hosting" - this is the setting to enable website hosting in AWS.

Makes sure to specify you Index document and if you have it your error document. And presto, your website is fully loaded and ready for traffic. You can leverage AWS CloudFront if you want to use your own custom domain name, enable security monitoring via the WAF. But the basics of getting up and running are set.

No AI used in the making of this post that I know of atleast 😀