Setup secure S3 website

Why host on S3 buckets?

Hosting a website can be a pain from a management perspective. Run the systems, get certificates, update and maintain everything, the list goes on… Luckly for static content, you can run a website relatively easy on AWS with the S3 service by combining it with Route53 (DNS service), Cloudfront (Content Delivery Network) and Certificate manager. Content can be created in whatever way you want, I prefer Hugo, which this blog is created with as well.

However, getting everything linked together and set up is scattered along multiple pages of the AWS documentation. Recently I had to setup a website again with this approach and found myself looking through different pages. In this post I want to capture the steps it takes.

Steps

  1. Register your domain (e.g. on Namecheap)
  2. Create S3 bucket with name of the domain, including your TLD
  3. Setup Hosted Zone in Route53
  4. Configure DNS Nameservers to match with Hosted Zone from step 3 in your domain registrar settings
  5. Create Certificate in us-east-1 region, main name is the domain.com and add *.domain.com for sub domains
  6. Create CloudFront distribution
  7. Link CloudFront to S3 bucket with an alias through Route53
  8. Add SSL certificate in the configuration
  9. Upload content to S3 bucket

Conclusion

Very short, very to the point article on why and how to run a website serverless on S3 with Route53 and CDN to avoid having to look over the documentation of AWS all the time.