Node.js on Google Cloud

Try It Free View Documentation

Node.js tools to build cloud-native apps, deploy at scale, and analyze data

  • Build planet-scale web apps
  • Use Google’s machine learning APIs with native library support
  • Write serverless apps with ease
  • Create big data analysis apps without learning another language
lovingly-crafted npm modules

Take advantage of our APIs and services using the @google-cloud npm modules and test run our code samples.

npm install --save @google-cloud/storage
Set up a Google Cloud project
  1. Sign in to your Google Account.

    If you don't already have one, sign up for a new account.

  2. Set up a Cloud Console project.

    Set up a project

    Click to:

    • Create or select a project.
    • Enable the Cloud Storage API for that project.
    • Create a service account.
    • Download a private key as JSON.

    You can view and manage these resources at any time in the Cloud Console.

Write your code
 * TODO(developer): Uncomment the following lines before running the sample.
// const bucketName = 'Name of a bucket, e.g. my-bucket';
// const filename = 'Local file to upload, e.g. ./local/path/to/file.txt';

// Imports the Google Cloud client library
const {Storage} = require('@google-cloud/storage');

// Creates a client
const storage = new Storage();

async function uploadFile() {
  // Uploads a local file to the bucket
  await storage.bucket(bucketName).upload(filename, {
    // Support for HTTP requests made with `Accept-Encoding: gzip`
    gzip: true,
    // By setting the option `destination`, you can change the name of the
    // object you are uploading to a bucket.
    metadata: {
      // Enable long-lived HTTP caching headers
      // Use only if the contents of the file will never change
      // (If the contents will change, use cacheControl: 'no-cache')
      cacheControl: 'public, max-age=31536000',

  console.log(`${filename} uploaded to ${bucketName}.`);

Node.js quickstarts
Quickly find and debug issues

Google Cloud operations products provide powerful monitoring, logging, and diagnostics to equip you with insight into the health, performance, and availability of cloud-powered apps, enabling you to find and fix issues faster.

Google Cloud's operations suite products
Unified monitoring, logging, and diagnostics for applications on Google Cloud and Amazon Web Services (AWS).
Error Reporting
A walk through of getting an error alert and investigating the error in the Cloud Console.
Monitor, diagnose, and fix
In this video, Aja Hammerly uses Cloud Monitoring, Cloud Logging, Error Reporting, Cloud Debugger, and Cloud Trace to find and fix some subtle errors in an example app.
Learn more
Join our community

Got something to say? Join our community to ask questions, or just chat with the experts at Google who help build Google Cloud and Node.js.