Hosting a Site on Google Cloud Storage

12 May, 2016 | TipsWeb/dev TipsTechVfd

This is part of my series of try some alternative hosting options. Next up, I decided to try Google Cloud Storage. Amazon's cloud platform is probably the best known, but it's far from the only one, with plenty of competitors, including Google.

Cloud Storage is their equivalent of Amazon's S3. It's designed to store files (and there are options about how fast it retrieves them), but can also be used to host static sites.

Getting Started

There's a free trial, with $300 of credit to use (although it expires after 60 days) which is simple enough to sign up for. The one irksome thing is that it requires you to register a payment method.

I happened to sign up with a Google Apps account and found I was unable to create a project (seemingly required) until the administrator (thankfully me) had enabled the Google Developers Console app. Something to be aware of.

I switched around Google's official instructions, partly because I had already read these, and partly because it was obvious I wanted to set my site up before I moved my DNS.

You then need to create a Cloud Storage Bucket, with the name of your domain as the bucket name. To do this you first need to verify you own it. You have to do this through Webmaster Tools, which was another app I needed to turn on in my Google Apps console.

Most of Google's instructions involve using their command line gsutil application, but can also be achieved through the web UI.


You then need to set the default object permissions (not the bucket permissions) to add a user called allUsers which has Reader access. You'll also need to edit the website configuration to set the default Main and 404 pages. Do this before you load files of you'll need to change them again.

Loading files was easy enough, with the option to load from the console window in my browser. It doesn't allow you to load directories though, so you'd have to create those manually. I ended up installing the Cloud SDK and using gsutil to bulk upload.

Lastly, set up a CNAME on your domain to point to c.storage.googleapis.com

Another 'gotcha' I stumbled across was that double forward slashes (//) weren't supported in URL paths. Some of my links were generated incorrectly and, while the other hosting options I've trialed have handled this, Cloud Storage returned a 404 for any page or resource referenced that way.

I had to set up a redirect in my registrar to get the www version of the site to point to the naked domain as Google doesn't support both in one bucket.

Speed

I again ran my standard series of tests once uploaded.

Original hostTest host
PS Rank (Mobile)88/10081/100
PS Rank (Desktop)93/10087/100
WPT First Byte0.156s0.348s
WPT Fully Loaded2.892s1.965s
WPT Bytes (KB)1,093347
GTMet YSlow88%84%
GTMet Load Time2.5s1.7s
GTMet Size (Mb)1.05327
GTMet Requests1515

Strangely, the Page Speed and YSlow scores took a small hit when compared to a standard LAMP host. This seems to have come down to some short cache times on CSS and image files where they thought they should be longer (it appears Cloud Storage defaults to an hour, but this can be increased).

First Byte also took a small hit, but the total load time improved and, as you can see, the page size dropped dramatically.

Summary

Set-up difficultyAverageIt certainly wasn't as easy as a regular host but the steps are quite straightforward.
Set-up timeGoodOnce you know where to go, it's pretty quick, but it was a little confusing, I had to install a utility to upload my files. It could be slicker and easier.
SpeedAverageNot the fastest host out there, nor does it claim to be.
CostGoodThe free credit was nice, but it would have code me just $0.01 for a month

Final Thoughts

The set-up process, while not particularly long-winded, was harder than it needed to be. Granted, I was twisting a tool to do a job it wasn't initially designed to do (though officially sanctioned), but there seemed a lot of steps. The fact that I had to install a command line utility to upload files in folders was especially galling.

In terms of pricing, I took advantage of some free credit, so it cost me nothing. If Google didn't time it out I'd have been able to run my site almost indefinitely, so small is the amount of traffic and storage. I had a particularly quiet month and so the cost to serve was lower than any previous host (had I actually been charged).

Performance-wise it did pretty well, offering reasonable speed, comparable to shared hosting, but not lightning by any stretch of the imagination.

You obviously get the benefit of access to the entire Cloud platform, although that probably just adds complexity if all you want to do is host a site.

Certainly not a bad way to host a static site though, and very cost effective. If you're tech-savvy then the command line may be seen as a benefit as you could automate deploys. Not an ideal platform though.