How to change the project in GCP using CLI commands

0 votes
How can I switch the active project in my GCP (Google Cloud Platform) account to a different project using cli commands rather than manually doing gcloud init?

The projects that are active on my account are listed in the gcloud projects list. I want to use a cli command to switch the active project to any other project in the list.
Nov 3, 2022 in GCP by Ashwini
• 5,430 points
1,057 views

1 answer to this question.

0 votes
gcloud config set project $MY_PROJECT_ID

#=>

Updated property [core/project].

You may also set the environment variable $CLOUDSDK_CORE_PROJECT

answered Nov 4, 2022 by Tejashwini
• 3,820 points

Related Questions In GCP

0 votes
1 answer

How to change the project in GCP using CLI command?

Hi@akhtar, If you configured GCP SDK in your ...READ MORE

answered Sep 13, 2020 in GCP by MD
• 95,440 points
2,283 views
0 votes
1 answer

How to create a new project in GCP using the command line?

Hi@akhtar, You need to configure GCP SDK in ...READ MORE

answered Nov 9, 2020 in GCP by MD
• 95,440 points
955 views
0 votes
1 answer

How to set the project property in the core section in GCP?

Hi@akhtar, The gcloud config set command sets the specified ...READ MORE

answered Nov 9, 2020 in GCP by MD
• 95,440 points
1,555 views
0 votes
1 answer

What are the service accounts in GCP? How to create one?

The special accounts associated with a project are called the Service Accounts. The ...READ MORE

answered Oct 9, 2019 in GCP by Sirajul
• 59,230 points
672 views
+1 vote
1 answer

In GCP, how to list all the resources running under project?

For a specific organization, folder, or project, ...READ MORE

answered Nov 10, 2022 in GCP by Ashwini
• 5,430 points

edited Sep 6, 2023 by Khan Sarfaraz 10,746 views
0 votes
2 answers
0 votes
1 answer
0 votes
1 answer

Changing Machine Instance on GCP

There is no direct method to change ...READ MORE

answered Aug 1, 2018 in GCP by kurt_cobain
• 9,390 points
407 views
0 votes
1 answer

Using the Google Cloud Platform SDK CLI to List all Active Resources Under a Given Project

For a specific organization, folder, or project, ...READ MORE

answered Nov 7, 2022 in GCP by Tejashwini
• 3,820 points
539 views
0 votes
1 answer

Google cloud: How to list all service-accounts from all Projects in GCP

It's been noted by the commenters that ...READ MORE

answered Nov 10, 2022 in GCP by Tejashwini
• 3,820 points
977 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP