Please note that the contents of this offline web site may be out of date. To access the most recent documentation visit the online version .
Note that links that point to online resources are green in color and will open in a new window.
We would love it if you could give us feedback about this material by filling this form (You have to be online to fill it)



Cloud Platform Tools

The command-line tools for Google App Engine, Compute Engine, Cloud Storage, BigQuery, Cloud SQL, and Cloud DNS are bundled as part of the Cloud SDK. All of the tools are located under the bin directory.

In the following sections, we provide examples of using some of these tools, and point out differences between their stand-alone versions and the versions bundled here.

Contents

gcloud preview app (App Engine)

Google App Engine allows you to build and run applications on Google’s infrastructure. App Engine applications are easy to build, easy to maintain, and easy to scale as your traffic and data storage needs change. Google Cloud SDK contains both the preview version of a new App Engine's command-line tool gcloud preview app , and App Engine Java , Python , PHP and Go SDKs.

With gcloud preview app , you can manage your applications, run them locally and deploy them to App Engine from the command-line. Here is a simple command to run your application locally (where DIRECTORY is a path to directory containing your app.yaml file):

$ gcloud preview app run DIRECTORY

Similarly, here is a command to deploy your application to App Engine:

$ gcloud preview app deploy DIRECTORY

See the Managing App Engine Applications guide for more information about gcloud preview app .

gcloud compute (Compute Engine)


Google Compute Engine offers scalable and flexible virtual machine computing capabilities in the Cloud. With gcloud compute , you can create machine instances, disks, networks, and firewalls from the command-line.

Before using gcloud compute , you have to sign up to use Google Compute Engine .

Below are a few examples of accomplishing common tasks with gcloud compute . For a tutorial showing you how to create an instance that can serve web pages, see Quickstart: Creating an instance and launching Apache . For more details on gcloud compute , see gcloud compute and gcloud compute Usage Tips in the Google Compute Engine documentation.

To get help about any gcloud compute resource or command, use the --help flag or see the gcloud compute Reference Documentation .

Creating an instance

To create an instance, use the instances create command:

$ gcloud compute instances create my-first-instance --zone us-central1-a

When creating an instance, you must specify at least a name and a zone . If you omit the --zone flag, gcloud compute checks to see if you have defined a compute/zone property and use that value; otherwise, it prompts you to choose a zone. For more information, see Setting a default zone and region .

Other instance settings like machine type and image will be set to default values, as described in the reference page for the create command.

Getting information about your instances

To get information about your instances, you can use the instances list and instances describe commands:

$ gcloud compute instances list
$ gcloud compute instances list --regexp my-.*
$ gcloud compute instances describe example-instance --zone us-central1-a

Connecting to your instances

You can use gcloud compute ssh to SSH in to your instance. For example, to SSH in to the instance named "my-instance" in the "us-central1-a" zone, you can use:

$ gcloud compute ssh example-instance --zone us-central1-a

For more information about copying files to and from your instance, and using your existing SSH-based programs to connect to your instances, see Connecting to Instances .

Adding and removing instance metadata

$ gcloud compute instances add-metadata example-instance \
  --zone us-central1-a \
  --metadata role=worker unique-id=1234 build-num=4.32

$ gcloud compute instances remove-metadata example-instance \
  --zone us-central1-a \
  --keys role unique-id build-num

For more information about instance and project-wide metadata, see Working with metadata .

Deleting an instance

The following command deletes the instance named "example-instance" in the "us-central1-a" zone.

$ gcloud compute instances delete example-instance --zone us-central1-a

Listing operations

To list all operations for a project, in a human-readable form, use:

$ gcloud compute operations list

gsutil (Cloud Storage)

gsutil allows you to access Google Cloud Storage from the command-line.

Here's a command that you can run to download data from a publicly-accessible bucket called uspto :

$ gsutil ls gs://uspto-pair/applications/0800401*

To learn more about gsutil , such as how to create and read protected data associated with your project, look here .

If you'd like to see the gsutil general reference, look here .

bq (BigQuery)

Google BigQuery is a web service that lets you do interactive analysis of massive datasets--up to billions of rows. BigQuery's bq tool provides access to this service via the command-line.

For example, run the following command to show the first 10 rows of the "Shakespeare" sample table:

$ bq head -n 10 publicdata:samples.shakespeare

You can find out more information about the bq command-line tool in BigQuery's documentation . Don't worry about authentication and project_id flags though, they will be set up for you by gcloud tool.

gcloud sql (Cloud SQL)

Access to the Google Cloud SQL Admin API is built into the gcloud tool. The Cloud SQL Admin API enables you to manage your instances, including creating, modifying, restarting, and deleting.

Here's a simple command to create a new Cloud SQL instance:

$ gcloud sql instances create your-instance-name

For more details on using gcloud sql , see Managing Instances Using the Cloud SDK in the Google Cloud SQL documentation.

gcloud dns (Cloud DNS)

Google Cloud DNS is a high performance, resilient, and global DNS service, which allows you to easily publish and manage DNS records. You can achieve this by using gcloud dns command-line tool.

For example, to create a managed Cloud DNS zone for your domain you could run the following command:

$ gcloud dns managed-zone create --dns_name="example.com." --description="A test zone" my-test-zone

Then you could edit the DNS record for my-test-zone by executing

$ gcloud dns records --zone=examplezonename edit

For more details on gcloud dns , follow the Getting Started tutorial in the Google Cloud DNS documentation.

Authentication required

You need to be signed in with Google+ to do that.

Signing you in...

Google Developers needs your permission to do that.