Static Hosting on S3 with Hugo

I’m building static sites because they’re cheap, low maintenance, and highly performant. I’ve been running Wordpress sites for years, but they always seem to be more work than they’re worth. I get tired of applying updates and then fixing plugins. Hugo was recommended to me by a friend on Twitter. I’ve been working on using it ever since.


Hugo is a blogging platform that generates static html pages, written in Go. You write your content in Markdown. Then, when you generate the site, it spits out hyperlinked html pages that are ready to be uploaded to your website. From the outside, it looks just like a Wordpress blog. Since it’s all html, there’s no need for a powerful server behind it. There’s no need to worry about versions of PHP or any server-side code. It’s just simple html.

AWS S3 Hosting

Since the site is just html, I chose to host using AWS S3 with website hosting turned on. The main reason I chose S3 is because the cost is incredibly low. You pay for storage and bandwidth. Storage is $0.023 per GB per month. This whole site is less that 10MB, so it probably won’t cost anything. For bandwidth, the first 1GB is free, and then $0.090 per GB for the next 10TB. The site’s small size and lack of server interaction will likely keep me under the 1GB for a long time. Also, S3 transfer to other AWS services, like CloudFront, is free.

Another big reason for choosing S3 is that it’s very powerful. I don’t have to worry about any sudden traffic spikes taking my site offline, since S3 is effectively limitless in its scale. I could put a static site on an inexpensive nginx server and be reasonably sure in it’s ability to handle large amounts of traffic, but that server would cost me significantly more per month than nearly free.

AWS CloudFront

Cloudfront is a caching service that sits in front of any web origin, caching requests for a specified amount of time. Given the scale of S3, CloudFront isn’t necessary. I’m using CloudFront for SSL termination. AWS offers free SSL certificates through their ACM service, but these certs only work with CloudFront or Elastic Load Balancers. The only cost of CloudFront is bandwidth, which runs $0.085 per GB for the first 10TB. So, for paying a little more for bandwidth than S3, I can get SSL for free. I think it’s a worthy tradeoff. It’s worth noting, HTTPS requests on CloudFront cost $0.0100 per 10,000 requests. This might get a little expensive if I have a lot of traffic. If the cost is an issue, I’ll drop SSL and host directly from S3.

Reference Code

Here is the code that I’m using to deploy this website:


Publishing with Hugo gives us the ability to host nearly anywhere for a very low fee. The template engine is robust and intuitive. The only issue I have right now is the lack of professional themes. I’ve found a nice one for now, but I’ll likely be building my own in the near future. Also, Hugo requires a build process prior to publishing, but I’ve solved that with a post-commit hook to a Lambda function. I’ll detail that in a later post.