How to Change the Project in GCP using CLI commands

To change the project in Google Cloud Platform (GCP) using the Google Cloud SDK (Command Line Interface), you can use the gcloud config set project command. The Google Cloud SDK, or gcloud, is a set of tools that enable you to manage resources and applications within GCP.

First, ensure you have installed the Google Cloud SDK on your local machine. If you haven’t, you can follow the installation instructions here:

Once you have the Google Cloud SDK installed, you can change the active project using the following command.

gcloud config set project PROJECT_ID

Replace PROJECT_ID with the actual project ID you want to switch to. This command will set the specified project as the default for future gcloud commands.

To verify that you have successfully changed the project, you can run the following command:

gcloud config list

This command will show the current configuration settings, including the active project.

Remember that you need appropriate access to the target project to perform any operations using the gcloud commands.

That’s it.

Leave a Comment