Compute Engine client libraries

The Compute Engine API is built on HTTP and JSON, so any standard HTTP client can send requests to it and parse the responses. However, instead of creating HTTP requests and parsing responses manually, you might want to use client libraries to do so.

Client libraries provide better language integration, improved security, and support for making calls that require user authorization. You can use the Compute Engine API through a number of Google-provided libraries or through third-party open source libraries that are known to work on Compute Engine.

Available libraries

Although you can use Cloud APIs by making direct HTTP requests to the server (or RPC calls where available), we provide different types of client libraries for Cloud APIs that makes them easier to access from your favorite languages.

For information on the different types of client libraries, see Client Libraries Explained.

Google API Client Libraries

The following Google API Client Libraries are available:

Library Language(s) Vendor Website Getting started on Compute Engine
Google API Go Client Library Go Google Website Documentation
Google API Java Client Library Java Google Website Documentation
Google API JavaScript Client Library JavaScript Google Website Documentation
Google API .NET Client Library .NET Google Website Documentation
Google API Node.js Client Library Node.js Google Website Documentation
Google API Objective-C Client Library Objective-C Google Website Documentation
Google API PHP Client Library PHP Google Website Documentation
Google API Python Client Library Python Google Website Documentation
Google API Ruby Client Library Ruby Google Website Documentation

Google Cloud Client Libraries

The following Google Cloud Client Libraries are available:

Library Language(s) Vendor Website Getting started on Compute Engine
Google Cloud Java Client Library Java Google Website Documentation
Google Cloud Node.js Client Library Node.js Google Website Documentation

The following Google Cloud Client Libraries are available in preview:

Library Language(s) Vendor Website Getting started on Compute Engine
Google Cloud Go Client Library Go Google Website Documentation
Google Cloud Java Client Library Java Google Website Documentation
Google Cloud .NET Client Library .NET Google Website Documentation
Google Cloud Node.js Client Library Node.js Google Website Documentation
Google Cloud PHP Client Library PHP Google Website Documentation
Google Cloud Python Client Library Python Google Website Documentation
Google Cloud Ruby Client Library Ruby Google Website Documentation

Community libraries

The following table contains a list of community libraries:

Library Language(s) Vendor Website Getting started on Compute Engine
libcloud Python Community Website Documentation
jclouds Java, Clojure Community Website Documentation
fog.io Ruby Community Website Documentation

Google API Go Client Library

This section contains information about getting started with the Compute Engine API using the Google APIs Go client library. In addition, you might be interested in the following documentation:

Downloading and installing the library

To install the library, run the following command:

go get google.golang.org/api/compute/v1

Using the library

Import the library in your code:

package main

  import (
      "google.golang.org/api/compute/v1"
  )

Google API Java Client Library

This page contains information about getting started with the Compute Engine API using the Google API Client Library for Java. In addition, you may be interested in the following documentation:

Sample

The compute-engine-cmdline-sample may help you get started using the client library.

Add Library to Your Project

Select your build environment (Maven or Gradle) from the following tabs:

Google API JavaScript Client Library

This section contains information about getting started with the Compute Engine API using the Google APIs JavaScript client library. In addition, you might be interested in the following documentation:

Using the API

To use the API, you must first load the library. In your code, add:

<script src="https://apis.google.com/js/client.js?onl