Welcome to My Education Lounge

A central location for all things security and tech related

Home
2 February 2019

Adding a subdomain to AWS hosted site

** This Guide assumes you already have a site hosted on AWS **

This is a reference for adding a subdomain for a site hosted on AWS. I wanted to create a subdomain for my business site and Amazon docs are super dry. I’ll break it down so we can all win.

Step 1: Login to AWS console

Ok so step one is pretty simple. Log into the console and open a tab for route 53 and another for s3.

Step 2: Create a new bucket

In the s3 tab let’s create a new bucket and name it subdomain.domain.com. Now for the rest of the settings I used my default settings from the main domain so I’ll just leave you to finish this dialog.

Step 3: Setting permissions

Click on your new bucket and do the following:

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "PublicReadGetObject",
            "Effect": "Allow",
            "Principal": "*",
            "Action": "s3:GetObject",
            "Resource": "your arn"/*"
        }
    ]
}

So your not blindly pasting things I’ll explain this “rule”. This policy allows for your bucket to be seen by the public. You need your bucket to be read-only so that your new subdomain is visable to the world.

Step 4: Static Hosting

Step 5: Pick your zone

The hosted zone should be the same zone that has your website. Once you click on it you should see a list of records like the A, SOA, and NS.

Step 6: Add a record

Hit the Create Record Set button at the top and you want to give it the following values:

Step 7: Enjoy

Hit Save Record and enjoy your new subdomain.


We are to the end of this and I just want to say, this doesn’t seem like a clean and efficient way to manage a website. My sites are pretty light but I guess as you grow and stop using static sites then you would move to something more robust. I’m not sure what that is yet or if it is needed for my situation.

P.S. I’m editing this on 2/12/2019….I no longer need this but it worked flawlessly. What was I building? A landing page for my podcast but I’m fine with another solution. Enjoy!

By: Keheira If you would like to donate to keep the content coming or just as a thank you, you can buy me a coffee or use cashapp.
tags: how-to