Go on Google Cloud Platform

Try It Free View Documentation

Build, deploy, debug, and monitor highly scalable Go apps easily

  • Run compiled high-performance code in the cloud
  • Dynamically scale capacity up or down as according to traffic
  • Get custom virtual machines based on your needs
  • Create, deploy, and protect your APIs using Google’s infrastructure
  • Build container images directly from Go source
  • Scale containerized apps on Kubernetes
A Broad Set Of Idiomatic Go APIs & Libraries

Take advantage of popular libraries in Go to access Google Cloud Platform services

1
Install the client library
go get -u cloud.google.com/go/storage
2
Set up a Google Cloud Platform 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.

3
Write your code

// Sample storage-quickstart creates a Google Cloud Storage bucket.
package main

import (
	"context"
	"fmt"
	"log"
	"time"

	"cloud.google.com/go/storage"
)

func main() {
	ctx := context.Background()

	// Sets your Google Cloud Platform project ID.
	projectID := "YOUR_PROJECT_ID"

	// Creates a client.
	client, err := storage.NewClient(ctx)
	if err != nil {
		log.Fatalf("Failed to create client: %v", err)
	}

	// Sets the name for the new bucket.
	bucketName := "my-new-bucket"

	// Creates a Bucket instance.
	bucket := client.Bucket(bucketName)

	// Creates the new bucket.
	ctx, cancel := context.WithTimeout(ctx, time.Second*10)
	defer cancel()
	if err := bucket.Create(ctx, projectID, nil); err != nil {
		log.Fatalf("Failed to create bucket: %v", err)
	}

	fmt.Printf("Bucket %v created.\n", bucketName)
}
Go quickstarts
Find and Fix Production Issues

Google Cloud operations products provide powerful logging, monitoring, and reporting capabilities. It equips you with insights into the health, performance, and availability of cloud-powered applications, enabling you to find and fix issues production faster.

Learn more
GO ON GCP COMMUNITIES

Got something to say? Join our community to ask questions, or just chat with the experts at Google who help build the support for Go on Google Cloud Platform.