To summarize, we did the following in this recipe:
- We created an S3 bucket as a static website (for example, qnatime.com)
- We created another S3 bucket, with a WWW prefix, as a static website (for example, www.qnatime.com)
- We added the files index.html and error.html
- We added a bucket policy that allows for everyone to read the bucket
- We created alias records for the primary domain and the WWW sub-domain, pointing to the S3 buckets (with and without a WWW prefix, respectively)
The S3 bucket names for static websites have to match the domain names exactly. For example, qnatime.com should point to a bucket named qnatime.com, and www.qnatime.com should point to a bucket named www.qnatime.com. Therefore, if someone has taken that bucket name, then you will not be able to use a custom domain to point to an S3 bucket. You can, however, overcome this limitation with the help of CloudFront, as you will see in a later recipe.