How to waste money hosting a website: load balancer edition
I was pretty excited about finding a project that would give me an excuse to learn Rust. That excitement faded away after just a few minutes when I realised the data-based website I wanted to build was simple enough that I could punt everything to the frontend and let it handle the filtering and sorting.
So I dusted off my Angular skills and threw together a little site in a couple of hours.
A lesson in expensive hosting
Next question, how to host this.
“What a great opportunity to play with Google Cloud,” I thought. I opted for throwing the files onto Google Cloud Storage, but then needed a way to serve the site from my own HTTPS hostname. My usual go-to for HTTPS proxying is Cloudflare, but I wanted to go GCP-native so popped a load balancer in front of the storage bucket. That worked a charm!
Until the first bill appeared. 18 CHF for a month of serving what a generous estimate of traffic would be 100 requests/day (the site isn’t launched yet and I’ll be honest I don’t expect that much more when it goes GA). That’s about 0.5 Rappen per request. Ouch. Of course, load balancers are just VMs so it makes sense. But for a hobby project that’s way too much money.
Adding a bit of flare
So back to Cloudflare it was. One quick redeploy later and after stopping the load balancer, I expect my bill to be ~0 next month. Much better.
It’s worth noting that if I’d not wanted to serve over HTTPS I wouldn’t have needed to add the load balancer so it would’ve been roughly free to host from a storage bucket, but I needed HTTPS, alas.
Picture credit (cropped): flickr
blog comments powered by Disqus