Time to “Hello, World”: running Node.js on VMs, Containers, Apps, and Functions — Part 5

Building with code functions

This article is a part of the series: Part 1 (overview), Part 2 (VMs), Part 3 (containers), Part 4 (apps) and Part 5 (functions & summary).

“Hello, World” on Cloud Functions

Cloud Functions is GCP’s serverless compute platform that runs your code in response to events originating from Google and/or 3rd-party services. At this level of compute service abstraction, you write and deploy single-purpose functions and your code executes in a fully-managed environment. (Unlike other articles in this series, this article doesn’t have “what’s involved with scaling” section since auto-scaling is the only option with Cloud Functions.)

1) Write and deploy the code

My epic quest to implement “Hello World” on Cloud Functions started and ended with the very first result returned by the following Google search: “google cloud functions http”. My job boiled down to navigating to the Cloud Functions tab in Google Cloud Console, enabling the Cloud Functions API, and clicking Create function button.

Let’s take a quick look at the defaults and… we’re done!

Let’s run a quick test using the GCF Console: specify function parameters in JSON format {“message”:“Hello from GCF!”} in Triggering event field and hit Test the function button.

2) Time check & getting started resources

Image source

Wow, that was easy! Every technology obviously has its strengths and weaknesses and Cloud Functions is not the right tool for every job. But at that point in my interview prep, I clearly knew what I wanted to work on if I ended up joining Google. (I am somewhat biased at this point and can talk about the sheer awesomeness of Cloud Functions for hours, but I will always clearly remember that initial “aha” moment and feeling of ultimate developer productivity!)

Useful getting started resources:

Time-to-results comparison and concluding thoughts

Although this might be somewhat like comparing apples and oranges, here is a summary of my results. (As a reminder, this is in the context of standing up a “Hello, World” web application from scratch, all other concerns such as running the app in production aside.)

Time to “Hello, World”, my results

Your speed-to-results could be very different depending on multiple factors, including your level of expertise with a given technology. My goal was to grasp the fundamentals of every option in the GCP’s compute stack and assess the amount of work required to get from point A to point B… This said, if there is ever a cross-technology Top Gear fighter jet vs. car style contest on standing up a scalable HTTP microservice from scratch, I wouldn’t be afraid to take on a Kubernetes grandmaster like Kelsey Hightower with Cloud Functions. :)

Thank you for following through all my ramblings to reach this point. I would love to hear your getting started experiences and/or thoughts on how you would go about ramping-up from zero to “Hello, World”.

To find out more about application development on GCP, please check out Computing on Google Cloud Platform and try it out for yourself today with $300 in free credits when you sign up.

Happy building!