\*\* *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 {#step1logintoawsconsole}
============================
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 {#step2createanewbucket}
===========================
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 {#step3settingpermissions}
===========================
Click on your new bucket and do the following:
- Got to the permissions tab
- Got to bucket policy
- Paste the following
```{=html}
<!-- -->
```
{
"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 {#step4statichosting}
======================
- Go to properties tab
- Click static hosting
- Use this bucket to host a website
- Fill in the info (I just used the default index.html and error.html)
- Hit save
Step 5: Pick your zone {#step5pickyourzone}
======================
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 {#step6addarecord}
====================
Hit the `Create Record Set` button at the top and you want to give it
the following values:
- Name: subdomain.domain.com
- Type: A-IPv4 address
- Alias: Yes
- Alias Target: the same value as your main domain
Step 7: Enjoy {#step7enjoy}
=============
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!*