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.

Avatar

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

Luca Casartelli
Luca Casartelli
— April 19, 2019

4 Key Takeaways from Google Cloud Next ’19

Google Cloud Next ’19 was the flagship Google Cloud Platform developers conference, held in San Francisco’s Moscone Center. I was lucky enough to attend it with Cloud Academy, and got the chance to check out tons of breakout sessions and get great insight firsthand.   Next ’19 was my...

Read more
  • Google Cloud Platform
  • Kubernetes
  • Machine Learning
Avatar
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
Avatar
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
  • AWS
  • Azure
  • Cloud Computing
  • Google Cloud Platform
Avatar
Guy Hummel
— November 21, 2018

Google Cloud Certification: Preparation and Prerequisites

Google Cloud Platform (GCP) has evolved from being a niche player to a serious competitor to Amazon Web Services and Microsoft Azure. In 2018, research firm Gartner placed Google in the Leaders quadrant in its Magic Quadrant for Cloud Infrastructure as a Service for the first time. In t...

Read more
  • AWS
  • Azure
  • Google Cloud Platform
Avatar
Cloud Academy Team
— September 18, 2018

How to Optimize Cloud Costs with Spot Instances: New on Cloud Academy

One of the main promises of cloud computing is access to nearly endless capacity. However, it doesn’t come cheap. With the introduction of Spot Instances for Amazon Web Services’ Elastic Compute Cloud (AWS EC2) in 2009, spot instances have been a way for major cloud providers to sell sp...

Read more
  • AWS
  • Azure
  • Google Cloud Platform
  • SpotInst
Avatar
Guy Hummel and Jeremy Cook
— August 23, 2018

What are the Benefits of Machine Learning in the Cloud?

A Comparison of Machine Learning Services on AWS, Azure, and Google Cloud Artificial intelligence and machine learning are steadily making their way into enterprise applications in areas such as customer support, fraud detection, and business intelligence. There is every reason to beli...

Read more
  • AWS
  • Azure
  • Google Cloud Platform
  • Machine Learning
Avatar
Andrew Larkin
— June 26, 2018

Disadvantages of Cloud Computing

If you want to deliver digital services of any kind, you’ll need to compute resources including CPU, memory, storage, and network connectivity. Which resources you choose for your delivery, cloud-based or local, is up to you. But you’ll definitely want to do your homework first. In this...

Read more
  • AWS
  • Azure
  • Cloud Computing
  • Google Cloud Platform
Avatar
Ben Lambert
— February 15, 2018

Is Multi-Cloud a Solution for High Availability?

With the average cost of downtime estimated at $8,850 per minute, businesses can’t afford to risk system failure. Full access to services and data anytime, anywhere is one of the main benefits of cloud computing. By design, many of the core services with the public cloud and its unde...

Read more
  • AWS
  • Azure
  • Cloud Adoption
  • Google Cloud Platform
Avatar
Cloud Academy Team
— January 25, 2018

New Whitepaper: Separating Multi-Cloud Strategy from Hype

A 2017 RightScale survey* reported that 85% of enterprises have embraced a multi-cloud strategy. However, depending on whom you ask, multi-cloud is either an essential enterprise strategy or a nonsense buzzword. Part of the reason for such opposing views is that we lack a complete de...

Read more
  • AWS
  • Azure
  • Google Cloud Platform
Stefano Bellasio
Stefano Bellasio
— January 15, 2018

4 Trends That Will Change How Companies Invest in Cloud in 2018

The cloud is forever changing how we look at IT. Over the past years, we’ve had a front seat view of how the cloud has evolved and how large companies and industries are changing practices internally toward a response that looks more and more like  the innovation leaders have read about...

Read more
  • AWS
  • Azure
  • Cloud Migration
  • Google Cloud Platform
Avatar
Cloud Academy Team
— September 19, 2017

New on Cloud Academy, September ’17. Big Data, Security, and Containers

Explore the newest Learning Paths, Courses, and Hands-on Labs on Cloud Academy in September. Learning Paths and Courses Certified Big Data Specialty on AWS Solving problems and identifying opportunities starts with data. The ability to collect, store, retrieve, and analyze data me...

Read more
  • AWS
  • Big Data
  • Docker
  • Google Cloud Platform
Avatar
Cloud Academy Team
— July 6, 2017

New Azure, Google Cloud, DevOps Learning Paths & Labs: Get Ready for your Certification!

At Cloud Academy, we’re busy adding new content to help you achieve your goals across AWS, Microsoft Azure, Google Cloud Platform, and DevOps. Whether you’re looking to get certified or just want to learn new skills, we know that getting started can be a stumbling block for learners ...

Read more
  • Azure
  • Google Cloud Platform
  • IoT