How To Change The Project In GCP Using CLI Commands ?
Last Updated :
03 Jul, 2024
Google Cloud Platform(GCP) offers various Cloud services such as cloud storage, cloud computing, deploying and scaling applications in the cloud e,c. GCP offers pay-per-use services. Apart from these, GCP offers many other services like hosting your websites in the cloud, running your own Operation System from the Cloud, and other cloud computing processes.
Projects In Google Cloud Platform ( GCP )
In GCP, projects are basic units that act as containers to organize the work, resources, billings, etc. Each project has its resources, access controls, billings, etc. The cost for resources is calculated and billed separately for each project. You need to set up a project first to work with any cloud service offered by GCP. Each GCP project contains a unique PROJECT_ID and a PROJECT_NUMBER. While the PROJECT_ID is user-defined, the PROJECT_NUMBER is assigned by GCP.
GCP Console Vs CLI
GCP offers both CONSOLE and a Command Line Interface (CLI). The Console is the Graphical User Interface (GUI) to interact with the platform. You can use the Console to create a project, change the project, launch a VM etc. On the other hand, CLI is the command line tool to interact with the platform. You can use commands to create or change the project and all other tasks.
Steps To Change The Project In GCP Using CLI Commands
Step 1: Goto GCP Cloud Console
Step 2: Create a Project
Step 3: Activate Cloud Shell from the GCP Console.
- Cloud Shell is the Command Line tool provided by GCP.
- Click on the top right button as shown below to activate Cloud Shell. We need to activate the Cloud Shell to interact with GCP using CLI commands.

Step4: List all the projects
- Once the Cloud Shell is activated, list all the projects using the below command:
gcloud projects list
- The above command will list all the projects in your GCP account as shown below.
- You can see the PROJECT_ID, NAME and PROJECT_NUMBER for all the projects. Kindly note the PROJECT_ID of the project to which you need to change.

- The above image shows that I have three projects in my GCP account. They are
1. My First Project
2. GeeksforGeeks Project and
3. geekyWebsite
- In the remaining section, I will walk you through how to change the project from Website for geek to GeeksforGeeks Project.
- Kindly note the PROJECT_ID of GeeksforGeeks Project is geeksforgeeks-project1.
Step 5: Check the currently configured Project
Before changing the project, check the currently configured project using the below command
gcloud config list project
The above commands give the PROJECT_ID of the currently configured project as project = PROJECT_ID. The below image shows that I am in the project named "Website for geek" with PROJECT_ID as geekywebsite.

Step 6: Change the project using the below command
gcloud config set project PROJECT_ID
- For example, if I want to change the project from Website for geek to GeeksforGeeks Project I will use the below command
gcloud config set project geeksforgeeks-project1
- geeksforgeeks-project1 is the PROJECT_ID of GeeksforGeeks Project. You can check the ID from the previous all projects list image.
Step 7: Confirm the change
- This can be done by checking the currently configured project in our previous command
gcloud config list project
- As you can see the PROJECT_ID is now changed to geeksforgeeks-project1 from the below image.

Congratulations! You have successfully changed the project using CLI commands.
Similar Reads
How to Change the Directory in Linux | cd Command
Navigating the Linux file system is like exploring a vast library; each directory (folder) holds its own collection of files and subdirectories, and knowing how to move between them efficiently is the first step to mastering the command line. The cd (Change Directory) command is your compass in this
7 min read
How To Change The Root Folder Of Your Git Repo?
Changing the root folder of your Git repository involves moving the .git directory to a new location and ensuring that your project's files are in the correct structure relative to this new root. To change the root folder of your Git repository, you essentially need to move the .git directory to the
1 min read
How To Delete Project In GCP ?
Google Cloud Platform is one of the leading Cloud service providers in the market of Cloud Computing providing various cloud services to developers and organizations. Google Cloud helps organizations to migrate to online platforms and get rid of managing physical servers for operation. Services like
7 min read
How To Create GCP Bucket Using CLI ?
Users can store and manage their data in the cloud with Google Cloud Storage (GCS), the service is provided by the Google Cloud Platform (GCP). Having the big virtual hard drive to store files, documents, photos, movies, and other media is similar to that. Within Google Cloud Storage, a bucket refer
4 min read
How to Create Load Balancer in GCP using Terraform ?
As traffic controls, load balancers on the Google Cloud Platform (GCP) distribute incoming requests among multiple instances of your application. Consider them as traffic engineers that direct customers to the busiest locations to deliver a dependable and responsive service, especially during period
5 min read
How to Create Admin & Client App in One Project Using Android Studio?
You all must know about projects in which two applications are required one for the client and the other for the admin. Here we will see how we can implement both the applications under a single project in android studio. Let us see the step-by-step implementation of this procedure. Step by Step Imp
2 min read
How To Change the Remote a Branch is Tracking in Git?
In Git, branches allow multiple developers to work on different features or fixes simultaneously. Often, a branch is set to track a remote branch, which means that Git can keep track of which commits have been pushed to or pulled from that remote branch. There might be situations where you need to c
3 min read
How to Change Commit Message in Git?
Changing a commit message in Git can be done in a few different ways, depending on whether the commit is the most recent one or an earlier commit. Here's an article on how to change a commit message in Git, covering scenarios both before and after the commit has been pushed to a remote repository.Th
3 min read
How To Create A GCP Project ?
Google Cloud Platform is one of the leading providers of cloud computing in the industry. GCP provides multiple services, like infrastructure as a service (IaaS), platform as a service (PaaS), and many more. Using the Google Cloud Platform, businesses can get rid of managing physical servers and ins
7 min read
How to Change the Commit Author for a Single Commit?
Changing the author of a single commit in Git can be done using an interactive rebase. This process involves rewriting the commit history, so it's important to proceed carefully, especially if you've already shared the commits with others. Hereâs a step-by-step guide on how to change the commit auth
3 min read