Seven months later, analyzing the cost of hosting a Hugo-based site on Microsoft Azure

Thursday, April 16, 2020 9:55 AM

In August 2019 I relaunched this site as a static site, generated using Hugo, and hosted on Azure. Moving to a static site brought quite a few benefits, from speed, ease of authoring new content, and simplicity. While it wasn’t a factor in the decision to move to a static site, cost has been another huge benefit. I’m saving over 97% per month by switching from a dynamic to a static site!

Looking back: Azure costs for the old site

First, let’s look back and compare what it took to host the old & dynamic site on Azure, both in terms of what resources I needed and the associated costs.

The site was formerly hosted on an Azure App Service (standard plan, s1) using Orchard, an open source .NET CMS. The Orchard instance was configured for multi-tenant as it was hosting both this blog and my podcast site, Microsoft Cloud Show. Orchard required a SQL database (single standard plan) and Azure storage accounts (standard blobs configured for locally redundant storage). My blog was responsible for at least 70% of the traffic and load between both sites hosted by my Orchard instance.

The app service was configured to auto scale in times of higher sustained load on the site (80% sustained resource utilization for more than 5 minutes), up to 6 instances, which happened on average 2-5 times per week. The other expense associated with this site was the data egress… how much data was sent to serve the pages. This does not include the large MP3’s for the podcast because they are hosted in an external service for podcast-specific analytics tracking purposes.

It’s hard to be certain how much of the cost should be allocated to my site vs. the podcast site, so I’ll share the exact numbers & provide my best estimate. The Azure bill for the month of March 2019 to host the configuration above was $256.26 with the vast majority coming from the following resources:

  • App service (the web app): $89.40
  • Data transfer out (bandwidth): $86.92
  • Blob storage (hot LRS disk storage): $45.45
  • SQL Server database: $15.00

My best guess, as I said above, is that my site accounted for around 70% of the costs, so I’ll say $179 for the month of March 2019.

Azure hosting costs for static site

After hosting my site on Azure as a static site, generated by Hugo, for the last seven months, I have a pretty good idea on costs. While I’m already thrilled with the benefits I’m already enjoying, the cost savings are shocking. I expected to save a ton removing the dynamic part of the site, but not this much!

First, let’s compare apples to apples and see what it takes to host my site on Azure as a static site. There’s an Azure blob to store the files, then I have an Azure CDN configured for performance reasons and as a way to serve the site up via HTTPS. I’m also using Azure Search on the site and Azure DevOps Pipelines to handle automated builds, deployments, purging the CDN cache endpoints when updates are published as well as to trigger Azure Search to re-index the site.

So how much does this cost? Monthly expenses have been very consistent. I’m seeing savings of 97%! Yup… it cost only $5.95 to host the site in March 2019!

March 2020 Azure Costs for hosting AndrewConnell.com
March 2020 Azure Costs for hosting AndrewConnell.com

Breaking it down by resource (I actually have two instances, only one backed by a CDN, as the preview site is on a funky URL I use to view content in draft mode):

  • Blob storage (hot LRS disk storage): $3.67
  • CDN: $2.03
  • Blob storage (hot LRS disk) dupe preview site: $0.25
  • Search (free tier): $0.00

In the interest of full transparency, here’s what it cost each months since relaunching the site:

  • September 2019: $8.03
  • October 2019: $5.62
  • November 2019: $4.85
  • December 2019: $5.90
  • January 2020: $5.98
  • February 2020: $6.34
  • March 2020: $5.95

Final assessment

Don’t mistake this post as a perfect apples-to-apples comparison. First, the capabilities of a dynamic site vs. a dynamic CMS are very different. For me, the static site is a better solution because of the following reasons, in order of most importance to least importance:

  1. Speed: Page load time.
  2. Reliability: There’s nothing dynamic to go down… if a service is unavailable (Azure CDN), there’s nothing I can or need to do to resolve it. That’s on Microsoft.
  3. Authoring simplicity: I love writing in markdown & with automated scheduled builds, I can publish & expire content in the future with ease.
  4. Cost: Honestly I would have paid more to get the three reasons above, but to get them AND save over 90%, that’s just icing on the cake.

In addition, it’s not a perfect comparison because the old setup hosted two sites, not just one. We did port the podcast site to the same setup and are seeing even lower monthly costs, so you can factor that into it.

My goal in this post was to primarily share what the real costs are for hosting a static site on Azure. I added the additional details in the interest of full transparency.

comments powered by Disqus