Penny Pinching in the Cloud: Azure Static Web Apps are saving me money
I've long run a few dozen websites in Azure and while I've long noticed people (frankly) wasting money by having one Azure App Service (a Web Site) per Azure App Service Plan (a VM) I tend to pack them tight.
A Basic 1 (B1) Azure App Service running Linux is around $13 a month but has nearly 2 gigs of RAM. Up that to about $26 a month and you've got 3.5 gigs of RAM and 2 Cores AND 10 gigs of storage. Use ALL that RAM. Max out that storage - use the resources you have paid for. If you hit up against a limit you can always add more and scale up. Run those boxes hot, you paid for them!
While my blog and podcast and main site run on Azure Premium SKUs (and are fast and it's worth it) I have a dozen little one pagers, brochureware sites, and toys like https://www.keysleft.com/ and I've managed them all in an App Service as well. But they are static sites. They are nothing sites...so why do I need an App Service? It's overkill.
Turns out Azure Static Web Apps are a lovely thing and they are FREE while in Preview. It's great for static sites, sites made with static site generators, or Jamstack sites with serverless functions behind them.
So I converted a bunch of my little sites to Azure Static Web Apps. Took maybe 90 minutes to do 8 of them as seen below.
Since the code for these sites was already in GitHub, it was very easy to move them.
For example, the code for the KeysLeft site is at https://github.com/shanselman/keysleft and Azure Static Web Apps has a GitHub Action that easily deploys it on every commit. It's butter. It's created for you but you can see the generated GitHub Action as it lives alongside your code.
The docs are clear and it works nicely with Vue, React, Angular, or just regular HTML like my son's Hamster Blog. https://www.myhamsterblog.com/
As it's in Preview now it's free, and I'm sure it'll be super cheap when it goes live. I have no idea how much it will cost but I'll worry about that later. For now it's allowed me to turn off an entire Azure App Service and replace it with Azure Static Web Apps.
They also support custom domains and they automatically make and assign you an SSL cert. My only complaint is that there's no easy support (today) for apex domains (so all mine have www. as CNAMES) but you could proxy it through a free Cloud Flare account if you really want.
Check it out, I suspect you have a site right now that's either generated or just static and this could save you some money.
Sponsor: Protect your apps from reverse engineering and tampering with PreEmptive, the makers of Dotfuscator. Dotfuscator has been in-the-box with Microsoft Visual Studio since 2003. Visit preemptive.com/hanselminutes for a professional-grade trial.
About Scott
Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.
About Newsletter