As an alternative to using the Dataproc Metastore APIs,
you can manage and access Dataproc Metastore services
using Google Cloud CLI gcloud metastore commands.
This page explains how to get started using the Google Cloud CLI, so you can use it to interact with Dataproc Metastore.
Before you begin
- Sign in to your Google Cloud account. If you're new to Google Cloud, create an account to evaluate how our products perform in real-world scenarios. New customers also get $300 in free credits to run, test, and deploy workloads.
- 
    
    
      In the Google Cloud console, on the project selector page, select or create a Google Cloud project. Roles required to select or create a project - Select a project: Selecting a project doesn't require a specific IAM role—you can select any project that you've been granted a role on.
- 
      Create a project: To create a project, you need the Project Creator
      (roles/resourcemanager.projectCreator), which contains theresourcemanager.projects.createpermission. Learn how to grant roles.
 
- 
  
  
    
      Enable the Dataproc Metastore API. Roles required to enable APIs To enable APIs, you need the Service Usage Admin IAM role ( roles/serviceusage.serviceUsageAdmin), which contains theserviceusage.services.enablepermission. Learn how to grant roles.
- 
      Install the Google Cloud CLI. 
- 
          If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity. 
- 
        To initialize the gcloud CLI, run the following command: gcloud init
- 
    
    
      In the Google Cloud console, on the project selector page, select or create a Google Cloud project. Roles required to select or create a project - Select a project: Selecting a project doesn't require a specific IAM role—you can select any project that you've been granted a role on.
- 
      Create a project: To create a project, you need the Project Creator
      (roles/resourcemanager.projectCreator), which contains theresourcemanager.projects.createpermission. Learn how to grant roles.
 
- 
  
  
    
      Enable the Dataproc Metastore API. Roles required to enable APIs To enable APIs, you need the Service Usage Admin IAM role ( roles/serviceusage.serviceUsageAdmin), which contains theserviceusage.services.enablepermission. Learn how to grant roles.
- 
      Install the Google Cloud CLI. 
- 
          If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity. 
- 
        To initialize the gcloud CLI, run the following command: gcloud init
Get started with the Google Cloud CLI
To start with the gcloud CLI, review the
Google Cloud CLI Documentation.
You can get help for the tool, resources, and commands by using the --help
flag:
gcloud metastore --help
The Google Cloud CLI reference also provides the information
shown by the --help flag.
Set default configuration properties in your local client
Most gcloud metastore commands require a location, which you specify using
the --location flag or by setting the default location. You can also set the
default project and tier for your Dataproc Metastore services.
- To set the default project, run the following command:
 gcloud config set project PROJECT_ID where PROJECT_ID is the ID of the Google Cloud project that the Dataproc Metastore service belongs to. 
- To configure the Dataproc Metastore location, run the following command:
 gcloud config set metastore/location LOCATION where LOCATION is a supported region such as us-central1.
- To configure the Dataproc Metastore tier, run the following command:
 gcloud config set metastore/tier TIER where TIER sets the capacity of the new service. 
- Optional: To list the configuration for the gcloud CLI, run the following command:
 gcloud config list