Tuesday, September 28, 2021
No menu items!
HomeCloud ComputingRun code samples directly in the Google Cloud documentation

Run code samples directly in the Google Cloud documentation

We’re excited to announce a new documentation feature that lets you run code samples in Cloud Shell, without leaving the page. Sign in to your Google account, open Cloud Shell’s online terminal in the documentation, and run code as you’re reading about it:

This new feature makes it easier to explore Google Cloud by putting Cloud Shell at your fingertips. Now you don’t need to switch between the documentation and a terminal window to run the commands in a tutorial. The documentation has everything you need to try new products and services.

Cloud Shell even has common command-line tools and programming languages already installed, so you don’t need to track down libraries or deal with dependencies. Your development environment is always ready to use and up to date—just activate Cloud Shell and get started.

Activate Cloud Shell

Cloud Shell is available throughout our documentation set on Chrome desktop browsers (Version 74 or higher). To use Cloud Shell in the documentation, sign in and click the Activate Cloud Shell button at the top of the page.

When Cloud Shell is activated, you see a terminal at the bottom of the page. Select a Google Cloud project to use Cloud APIs and access your resources:

Get started fast

Cloud Shell has the Cloud SDK already installed, so you can get started right away—no setup required. After you activate Cloud Shell and set a Cloud project, you can use tools like gcloud to try new services as you read about them.

For example, you can use the terminal in the documentation to complete a Pub/Sub quickstart in seconds:

The terminal stays open when you go to a new page, so it’s easy to learn more and build solutions. When you’re done with the Pub/Sub quickstart, use your resources to create an app that authenticates mobile clients:

Manage resources

Let’s say that you deployed a web app and now you’re onboarding a team member to manage it. You want to grant access to your resources, so you’re looking for commands that update the project’s permissions.

The terminal in the documentation makes this easy. List your Pub/Sub topics as you search for commands in the gcloud reference, and then set an IAM policy on a Pub/Sub topic as you read a guide about granting access to resources.

Keep developing

If you’re using Cloud Client Libraries, you can customize and run sample code in the Cloud Shell Editor. To use it, activate Cloud Shell and click Open Editor:

The button opens the Cloud Shell Editor in a new tab. The online code editor has rich language support, local emulators, and more features that make it easy to build solutions with your favorite client library.

Try it out

We hope that the terminal in the documentation makes it easier to learn about Google Cloud and manage your resources. Not sure where to start? Activate Cloud Shell on these pages:

Getting started with Cloud StorageGetting started with our BigQueryDeploying a containerized web application

Related Article

Try a tutorial in the Google Cloud Console

You can follow tutorials and walkthroughs in the Google Cloud Console, allowing you to view the instructions and the console at the same …

Read Article

Cloud BlogRead More

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments