Using Google Cloud CLI with Cloud Composer

This page describes how to get started using Google Cloud CLI with Cloud Composer environments.

Before you begin

  • Google Cloud CLI uses Cloud Composer API to run gcloud composer commands, so you must enable the API.
  • Install Google Cloud CLI on your local client.

Getting started with the gcloud command-line tool

You can manage and access Cloud Composer environments with gcloud composer commands provided by Google Cloud CLI.

To start with the gcloud tool, review the Google Cloud CLI documentation. You can get help for the tool, resources, and commands by using the --help flag:

gcloud composer environments --help

The help displayed with the --help flag is also available in the Google Cloud CLI reference for gcloud composer.

Setting the default project and location in your local client

Most gcloud composer commands require a location. You can specify the location by using the --location flag or by setting the default location.

To set the default project and location for Cloud Composer:

  1. Set the default project by running the following command:

    gcloud config set project PROJECT_ID
    

    Replace the following:

    • PROJECT_ID: the Project ID of the project where your Cloud Composer environment is located.
  2. Configure the Cloud Composer location by running the following command:

    gcloud config set composer/location LOCATION
    

    Replace the following:

    • LOCATION: the region where the environment is located, such as us-central1 or europe-west1.
  3. (Optional) To list the configuration for Google Cloud CLI, you can run the following command:

    gcloud config list
    

What's next