Cyber Monday 2024! Hurry Up, Grab the Special Discount - Save 25% - Ends In 00:00:00 Coupon code: SAVE25
Welcome to Pass4Success

- Free Preparation Discussions

Google Exam Associate Cloud Engineer Topic 3 Question 74 Discussion

Actual exam question for Google's Associate Cloud Engineer exam
Question #: 74
Topic #: 3
[All Associate Cloud Engineer Questions]

You just installed the Google Cloud CLI on your new corporate laptop. You need to list the existing instances of your company on Google Cloud. What must you do before you run the gcloud compute instances list command?

Choose 2 answers

Show Suggested Answer Hide Answer
Suggested Answer: A, E

Before you run the gcloud compute instances list command, you need to do two things: authenticate with your user account and set the default project for gcloud CLI.

To authenticate with your user account, you need to run gcloud auth login, enter your login credentials in the dialog window, and paste the received login token to gcloud CLI.This will authorize the gcloud CLI to access Google Cloud resources on your behalf1.

To set the default project for gcloud CLI, you need to run gcloud config set project $my_project, where $my_project is the ID of the project that contains the instances you want to list.This will save you from having to specify the project flag for every gcloud command2.

Option B is not recommended, because using a service account key increases the risk of credential leakage and misuse.It is also not necessary, because you can use your user account to authenticate to the gcloud CLI3. Option C is not correct, because there is no such thing as a Cloud Identity user account key.Cloud Identity is a service that provides identity and access management for Google Cloud users and groups4. Option D is not required, because the gcloud compute instances list command does not depend on the default zone. You can list instances from all zones or filter by a specific zone using the --filter flag.


1: https://cloud.google.com/sdk/docs/authorizing

2: https://cloud.google.com/sdk/gcloud/reference/config/set

3: https://cloud.google.com/iam/docs/best-practices-for-managing-service-account-keys

4: https://cloud.google.com/identity/docs/overview

: https://cloud.google.com/sdk/gcloud/reference/compute/instances/list

Contribute your Thoughts:

Vivan
8 months ago
Ooh, good catch! Setting the project and zone sounds like a more straightforward way to get the CLI ready to list instances. Although, if I remember correctly, don't we need to do both the auth login and the config set commands?
upvoted 0 times
...
Anabel
8 months ago
You know, I was thinking the same thing. The service account feels like overkill for just listing instances. Maybe we should try the gcloud config commands instead to set the project and zone?
upvoted 0 times
...
Margret
8 months ago
Yeah, I agree. We'll need to authenticate somehow. But I'm not sure if the service account key is the right approach here. Wouldn't that be more for programmatic access?
upvoted 0 times
...
Vilma
8 months ago
Hmm, this is a tricky one. I think the key is to authenticate with the Google Cloud CLI before you can list the instances. I'm pretty sure we need to run gcloud auth login first to get our credentials set up.
upvoted 0 times
Cherilyn
8 months ago
B) Create a Google Cloud service account, and download the service account key. Place the key file in a folder on your machine where gcloud CLI can find it.
upvoted 0 times
...
Edgar
8 months ago
A) Run gcloud auth login, enter your login credentials in the dialog window, and paste the received login token to gcloud CLI.
upvoted 0 times
...
...

Save Cancel