Skip to main content

gcloud-node: the Library for Node.js on Google Cloud Platform

Just a few hours ago Google announced very interesting news about improved support for Node.js on its Cloud platform. In fact, a client library for Node.js has been released by BigG for better integration of Cloud Datastore and Cloud Storage into Node.js applications. According to Google announcement, this is just the first of a set of libraries and new APIs that will be released soon to help developers build applications that take full advantage of Google resources. Very good news indeed, that will help the adoption of the Google Cloud Platform by developers who are interested in deploying their application in the Cloud.

What is Node.js?

Node.js is a very interesting technology originally developed by Ryan Dahl a few years ago. Shortly said, Node.js is a cross-platform runtime environment for server-side and networking applications. Node.js applications are written in JavaScript and can be run within the Node.js runtime on different operating systems with no changes. Given its asynchronous architecture, it is commonly used for real-time applications, and its built-in asynchronous I/O library for file, socket and HTTP communication opened the door to a lot of applications that acts as a server without using a native web server like Apache or Nginx. In fact, Node.js become widely popular as a high-performance server-side platform and quickly become the de-facto standard for server-side JavaScript.

Node.js is not free from accusations of being a bad technology. For example, many developers complain about the single-threaded design of Node.js, that doesn’t take advantage of modern multi-core CPUs. Some others criticize it for not being ready for distributed applications, or for its immaturity, or for the availability of a potentially risky package manager, and even more. No technology is perfect, and Node.js isn’t too, of course. It’s a very interesting framework that found many different areas where it fits perfectly and does a really great job. It comes to no surprise to me that Google saw such a big value in it to write and deliver a dedicated library.

gcloud-node

The new library Google wrote and announced today is targeted at reducing the boilerplate code you need to write when you try to access GCP services. Installation is quite easy, thanks to the availability of the software through the Node.js Package Manager under the name of “gcloud“. Being released under an open source license though, you can expect to find it available in top tier Linux distributions’ archives very soon. In any case, the configuration is quite easy and mostly consists of setting up the authentication. Quite interestingly, this is almost automatic if you deployed gcloud on Google Compute Engine instance that is already prepared to use service accounts: Google just takes care of everything. Otherwise, you need to turn on the APIs you are interested in from your Google Developers Console, adding the necessary credentials (client ID or JSON key) as always.

gcloud currently supports just two services: Cloud Datastore and Cloud Storage. It’s a shame other good stuff in the Google Cloud Platform is not available to gcloud-node yet, but hopefully, this will be fixed very soon. Nevertheless, the effort you need to spend to integrate those services seems quite small indeed. For example, take a look at this snippet of code, an example of integration with Datastore taken from Google’s announcement itself:
var gcloud = require('gcloud');
var dataset = new gcloud.datastore.Dataset({
projectId: 'my-project',
keyFilename: '/path/to/keyfile.json'
});

dataset.get(dataset.key('Product', 123), function(err, entity) {
console.log(err, entity);
});

Quite simple and effective indeed. And the availability of gcloud’s code on GitHub will definitely help it grow faster, thanks to contributions and bugfixes by community members who are interested in it. For more information about gcloud-node, take a look at the extensive documentation Google wrote on gcloud’s website.

Written by

Andrea Colangelo

Software Engineer with a solid focus on QA and an extensive experience in ICT. Above all, Andrea has a very strong interest in Free and Open Source Software, and he is a Debian and Ubuntu Developer since years. Non-tech interests include: Rugby, Jazz music and Cooking.

Related Posts

Giacomo Marinangeli
— March 29, 2019

NEW: Custom Hands-On Labs for Azure and Google Cloud Platform

Harvard Business Review recently estimated that some 90% of corporate training never gets applied on the job. Given the $200B training industry, that is a staggering amount of waste. One reason for the disconnect? Lack of context.Cloud Academy’s platform was built to make it extraor...

Read more
  • Azure
  • Content Engine
  • Google Cloud Platform
  • hands-on labs
Andrew Larkin
— January 15, 2019

2018 Was a Big Year for Content at Cloud Academy

As Head of Content at Cloud Academy I work closely with our customers and my domain leads to prioritize quarterly content plans that will achieve the best outcomes for our customers.We started 2018 with two content objectives: To show customer teams how to use Cloud Services to solv...

Read more
  • Amazon Web Services
  • Cloud Computing
  • Google Cloud Platform
  • microsoft azure
Michael Sheehy
— May 14, 2015

PaaS (Platform as a Service): The Top Five Cloud Players

The PaaS choicesFirst up, I guess we'll need to define Platform as a Service. I would describe PaaS environments as cloud computing services platforms that allow developers to launch and manage their web applications without having to confront the complexity of infrastructure creation...

Read more
  • Azure
  • Google Cloud Platform
Michael Sheehy
— May 6, 2015

Free Cloud Hosting: Comparing What the Top Providers Offer

Most providers offer some free cloud hosting to encourage you to get acquainted with their platforms. And some services actually remain free indefinitelyLet's face it, everyone likes something for free, and free cloud hosting is no different. Most providers offer some kind of free ser...

Read more
  • AWS
  • Azure
  • Google Cloud Platform
Andrea Colangelo
— October 13, 2014

The First Google Cloud Course Lands on Cloud Academy

(Update) Since publishing this post, we've released some great new content on Google Cloud Platform on the Cloud Academy training library, including Machine Learning on Google Cloud Platform, Google Data Engineer Exam Professional Certification Preparation, and Google Cloud Platform Fun...

Read more
  • Cloud Computing
  • Google Cloud Platform
Andrea Colangelo
— September 12, 2014

How to Move Your Startup to the Cloud: the Best Free Programs

Google's Senior Vice President for Technical Infrastructure Urs Hölzle just announced at the Google for Entrepreneurs Global Partner Summit a huge change in its company's free program for startup, that will now offer 100,000$ in cloud credits for those who qualify for the program. Quite...

Read more
  • AWS
  • Cloud Computing
  • Google Cloud Platform
Praveen Kumar Muppala
— August 13, 2014

SSH in the Browser: Pros and Cons of the Latest News in Google Developer Console

Remotely connecting to Linux VM instances using SSH (Secure Shell) with clients like OpenSSH or PuTTY is a common task for developers and administrators to perform their daily routine tasks. Nevertheless, there are many situations where it can be a little inconvenient, like for example ...

Read more
  • Google Cloud Platform
  • Security
Janakiram MSV
— July 14, 2014

Load Balancing in Google Compute Engine

Load balancing is an important feature of cloud infrastructure services. With the ability to rapidly launch VMs, it is important to ensure that all the VMs are evenly utilized. Amazon’s Elastic Load Balancer (ELB) is quite popular for its ability to route the traffic across a set of ins...

Read more
  • Compute
  • Elastic Load Balancer
  • Google Cloud Platform
Janakiram MSV
— July 10, 2014

When to Use Google BigQuery? Big Data in the Cloud

(Update) We’ve recently uploaded new training material on Big Data using services on Amazon Web Services, Microsoft Azure, and Google Cloud Platform on the Cloud Academy Training Library. On top of that, we’ve been busy adding new content on the Cloud Academy blog on how to best train y...

Read more
  • Big Data
  • Google Cloud Platform
Janakiram MSV
— July 8, 2014

Understanding Google Cloud Deployment Manager

One of the key components of Replica Pools is the template. It contains the declaration of the pool along with a set of attributes. You could think of the template as the metadata of the Replica Pool. This template is actually based on a standard format defined by another related featur...

Read more
  • Google Cloud Platform
Janakiram MSV
— July 4, 2014

Overview of Replica Pools in Google Compute Engine

Cloud is all about elasticity. Cloud infrastructure running web-scale applications can shrink and grow dynamically. Batch processing on the cloud will have to deal with on-demand instantiation of the machines based on the load.Google Compute Engine is a high performance, next-genera...

Read more
  • Compute
  • Google Cloud Platform
Andrea Colangelo
— June 7, 2014

Google Compute Engine: How to Control Your Daily Usage of the Cloud

A couple days ago, Ken Sim, Product Manager at Google, announced a new feature that will probably make smile those of you who are hunger for analytics about their cloud infrastructure. News is, Google finally added a mean to programmatic access detailed Google Compute Engine usage data,...

Read more
  • Compute
  • Google Cloud Platform