In previous post, we’ve talked about how the smallest VM instance “f1-micro” can handle incredible amount of traffic. But even with free tier, if your website has grown to some point, you’ll inevitably have to pay for the services. In this post, we’re going to breakdown all the cost involved when hosting website on Google Cloud Platform. Let’s check it out!
Virtual Machine Instance
Of course, you’ll need a server to host a website. If you own a small to medium traffic blog or static website, you can probably get away with free tier instance f1-micro with caching and CDN setup. But at some point, free tier won’t just cut it and you’ll have to expand (which is a good thing)
Unfortunately, the pricing information on Google Cloud pricing page is very detailed and can be intimidated for anyone who’s new to the cloud platform. So here is the essential.
First, the cost of VM Instance will be calculated at hourly rate which vary among VM zones. For example, VM in Los Angeles zone is more expensive than Iowa. So choose wisely. You can disregard the cheaper Preemptible rates as they are for temporary VM for a batch tasks like rendering or Mathematical calculation only.
Since we’re using it to serve website, the VM must be running 24/7 or 730 hours per month. The good news is you’ll get a maximum 30% of sustained usage discount.
There is also another type of discount which is from committed usage. Basically, it’s a 1-3 years contract for a selected instance. You’ll be billed monthly until the end of contract even you’re not using them. The discount rate is up to 57% so you might want to consider it if your website has a predictable traffic amount. Only n1-standard instance and above are eligible for commitment usage discount. Also it doesn’t stack with sustained usage discount.
Free tier give you 30GB of disk storage which should be enough for most static website. But if that’s not enough or you want to change it to SSD for performance reason, then you have to pay for an extra. You’ll be billed per GB/Month. For example, a 100GB disk in US zone will cost you $4 per month (0.040*100) or $17 per month for SSD with the same size.
The rates are varied by zone and get more expensive outside US. The example above will cost you $5.2 and $22.1 instead for Tokyo zone.
You’ll need to create a snapshot for backup. Just in case something goes wrong or your site was hacked, you can just restore the snapshot image and back to business.
Free tier give you a mediocre size of 5GB for snapshot storage which can barely store a single snapshot. So prepare for this extra cost. Again, you’ll be billed per GB/Month with cheaper rate than persistence disk. Both SSD and Standard disk are using the same rate per zone.
For example, if you have a 30GB disk in Iowa region and you use only 2GB then the snapshot size will be 2GB. Let’s say you keep around 10 snapshots before removing the oldest one. So that’s 2*10 = 20GB snapshot storage required. You’ll be billed with Iowa zone snapshot rate $0.026 GB/Month which is 20*0.026 = $0.52 per month.
Note: If you choose to store a snapshot in different region than the disk, then you’ll be billed with network bandwidth fee!!
You’ll need to pay for a bandwidth fee when your VM instance communicate with the internet. The ingress traffic is free (unless you have a load balancer) while egress traffic will be billed. Traffic to China and Australia are more expensive than the rest.
Free tier allows only 1GB of egress (well, better than nothing) So if your average page size is 200KB then you can have around 5000 pageviews (without cache) before exceeding free tier. You’ll be billed per GB/Month of egress traffic.
Using CDN/Cache/Reverse Proxy like CloudFlare can greatly reduce the network cost (in my case, it’s 70%)
Some of the OS images to be used on your disk are NOT free. If you want to use them then you’ll have to pay for it. You’ll be billed with hourly rate which get more expensive on larger VM Instance size. Below are some example.
- Red Hat Enterprise Linux
- SUSE Linux Enterprise Server
- Windows Server
- SQL Server
Hosting on Google Cloud means you’ll have to manage everything by yourself. There is no pre-installed convenient admin panel like CPanel or Plesk. However, you can purchase the license and install it to your VM instance if needed.
For Plesk, there is a one-click install solution on Marketplace.
Regular shared hosting plans usually provide you an email forwarding solution or webmail account for your own domain without extra cost. However, Google Cloud blocked SMTP port to prevent risk of abuse. So you’ll have to pay for a third party services or G-Suite.
There is a workaround though. If you registered your domain with Google Domain, you can still create alias address for your domain and have all incoming message forwarded to your personal Gmail account for free. You might want to considered transfer your domain to Google if you really don’t want to pay $6/month for G-Suite. I also made an article about free custom domain email forwarding services that you might want to check it out 🙂
The estimating cost of hosting website on Google Cloud Platform can be complicated as you have to separately estimate the cost of each services. However, it’s still cheaper than most shared hosting plan or VPS packages offers on the market. Especially, if you own a small to medium static website which could stay under their free tier. You can use Google Cloud Platform Cost Calculator to help with your estimate.
And that’s all for this post. Let me know in the comment if you have any questions and I’ll try my best to answer!