In previous post, we started with basics of AWS Route 53 and learnt how to register a domain and use it with a simple static website which is actually an S3 bucket configured to serve static contents.
We can visit the S3 based website on the following URL:
To recap previous post:
we can use Route 53 to associate a custom domain name with S3 bucket.
- We do that by simply creating an Alias record.
- Because its an alias , Apex records are allowed with alias in Route 53 (which means you could use example.com as apposed to www.example.com for your custom domain name).
- Now if you are going to use a simple alias record, then the bucket name must match record name (that means, you have to have the forethought of mind to name your bucket properly so that it will match the desired record name that you are going to create later).
Today, we will take one step further and see how to work with subdomains with help of simple and easy to follow demos.
Our static website is up and people can visit it by typing the above shown URL. However, if someone try to visit http://www.awsclouddemos.com/ URL, it will show that site can’t be reached as follows:
(note: you might see that it is working with above mentioned URL and later in post you will see the steps to get this done)
The reason is that www.awsclouddemos.com is a sub-domain and currently we have not configured Route 53 and S3 bucket to handle this address.
We want our users to be able to use www. your-domain-name.com, such as www.example.com, to access our sample website.
Following are steps:
- Create another s3 bucket, for your subdomain.
- Set up your subdomain bucket for website redirect.
- Add an alias record for your subdomain