In the spirit of fairness, since I've spent so much time using AWS Lambda functions, I thought I'd give Google's latest offering a try. However, following the instructions to create a simple cloud function triggered via HTTP, I ran into some immediate issues.

Firstly, the documentation seemed out-of-date. Although the interface was incredibly polished compared to Amazon's offerings, I was surprised to see that the tool provided to add gcloud command-line tools to the system PATH relied on which python returning the path to a Python 2 interpreter binary: something not at all made clear in the docs, and less clear still with the error message:

Luckily, this was resolved quickly by making two changes from which python to which python2. Immediately afterwards, however, the instructions provided for updating the Beta components (Google Cloud Functions are still in Beta!) proved to be inaccurate:

gcloud components update beta &&
gcloud components install

The first command did the trick, after asking me if what I really meant was the install command. Strange. But then the second command wasn't recognised at all. Luckily, I didn't have any problems with the deployments further down the line, so I have to assume that everything's been installed correctly. Still, it seems remarkably unpolished.

I was very impressed with the next step, however! With AWS Lambda functions, the option is provided to load code from an S3 bucket you've already created. Google has improved hugely on this by requiring only a single command to upload your code to a 'Cloud Storage bucket' and deploy it from there to a new function! I copied the slightly long-winded command into a file for future use:

gcloud beta functions deploy helloGET \
    --stage-bucket http-cloud-function-bk \

And here are the contents of the simple "Hello World" cloud function:

// index.js

 * This is a Google Cloud Function.                                             
 * It's designed to be accessed over HTTP.                                      
exports.helloGET = function helloGET(request, response) {
    response.send("Hello, world!");

After running for a worryingly long time -- the warnings that it might take 2 minutes plus are entirely valid! -- the function deployed successfully, and gave me a URL endpoint to ping in order to test my new Cloud Function!

Hold on, though. us-central1? Surely, I didn't choose that?! And maybe that'd explain the strangely long time it took for my GET request to receive a response?

After going through the Create Function flow again, outside of tutorial mode this time, it seems like Cloud Functions aren't available in any regions other than this one.

Hopefully, this changes soon!

Side note: while nosing around the documentation, I came across something handy, in the form of Cloud Functions Emulator: a local Node.JS server that "implements the Cloud Functions API" in order to enable local testing. Cool!

It's worth noting that while Cloud Functions are similar in many ways to AWS Lambda functions, they're also more limited: only the NodeJS runtime is supported currently, while to my knowledge AWS Lambda can support Java, C#, Python, JS and potentially many more (it's an open secret that Lambda functions run on EC2 boxes, so packaging up a Linux binary for your language's runtime might work just fine!). It's also worth pointing out that they aren't supported by the Serverless framework just yet, although plans are clearly in the works!

Finally, in order to eliminate any drains on my precious Free Trial Credit, I deleted the Cloud Function:

(N.B. it didn't really take 10 seconds; that's mostly how long it took me to press the Y key!)

It'll be interesting to see how Google innovates on this formula in order to compete with Amazon: the single-step upload and deploy process is a good start, but there's clearly a long way to go.