This document describes installation and usage of the
a command-line tool that is used to manage your Google Compute Engine resources.
If you haven't already activated Google Compute Engine, follow the Getting Started Guide.
gcutil runs on UNIX-based operating systems such as Linux and Mac OS X. To use
gcutil, you must have Python 2.6.x or 2.7.x installed on your computer.
gcutil does not support Python 3.x. Python is installed by default on most
Linux distributions and Mac OS X.
Download gcutil-1.14.2.tar.gz file.
Extract the files.
Run the following command to extract the tar file. This unpacks a directory named
sudo tar xzvpf gcutil-1.14.2.tar.gz -C /usr/local/share
Create a symbolic link to the
sudo ln -sf /usr/local/share/gcutil-1.14.2/gcutil /usr/local/bin/gcutil
If you modified your system path, restart your shell before continuing so the changes can take effect. To see a list of available
$ gcutil help
For additional information on authenticating with the Cloud SDK, such as if you are working in a terminal session on another machine, see the following section.
Google Compute Engine uses OAuth2 to authenticate and
authorize access. Before you can use
gcutil, you must first authorize the
Cloud SDK on your behalf to access your project and acquire an auth token. You
won't need to repeat these steps unless you delete your stored credentials file
or remove Google Compute Engine access to your Google account.
gcloud auth loginto request a token. This command prints a URL and opens a browser window to request access to your project.
$ gcloud auth login Your browser has been opened to visit: https://accounts.google.com/o/oauth2/auth?scope=https%3A%2F%2Fwww.googleapis.co%2 Fauth%2Fappengine.admin+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fbigquery+https %3A%2F%2Fwww.googleapis.com%2Fauth%2Fcompute+https%3A%2F%2Fwww.googleapis.com% Fauth%2Fdevstorage.full_control+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuser... Created new window in existing browser session.
You can also provide the
--no-launch-browserflag if your browser doesn't automatically load the URL. If you provide this flag, the tool will print out a verification code that you can copy and paste into a browser, instead of opening a new browser window.
$ gcloud auth login --no-launch-browser Go to the following link in your browser: https://accounts.google.com/o/oauth2/auth?scope=https%3A%2F%2Fwww.googleapis.co%2 Fauth%2Fappengine.admin+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fbigquery+https %3A%2F%2Fwww.googleapis.com%2Fauth%2Fcompute+https%3A%2F%2Fwww.googleapis.com% Fauth%2Fdevstorage.full_control+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuser... Enter verification code:
In the browser window, review the application permissions and click Accept when you are ready. If you used the
--no-launch-browserflag, copy and paste the printed code on the next page onto the command line. Otherwise, the code will automatically be sent to the command line without any additional action on your part.
(Optional) Next, you can set a default project to use with the tool. Since a project ID is required for every command, setting a default project saves you the hassle of repeatedly providing that information.
To set a default project, run:
$ gcloud config set project <new-project-id>
Similarly, to unset your project ID, run:
$ gcloud config unset project
You can also view your settings, including your project ID:
$ gcloud config list
Try a quick example, such as a
$ gcutil listinstances
That's it, you can now start using
gcutil! Here are some ideas to
get you started: