Google Cloud Associate Cloud Engineer — Question 98
You have a Google Cloud Platform account with access to both production and development projects. You need to create an automated process to list all compute instances in development and production projects on a daily basis. What should you do?
Answer options
- A. Create two configurations using gcloud config. Write a script that sets configurations as active, individually. For each configuration, use gcloud compute instances list to get a list of compute resources.
- B. Create two configurations using gsutil config. Write a script that sets configurations as active, individually. For each configuration, use gsutil compute instances list to get a list of compute resources.
- C. Go to Cloud Shell and export this information to Cloud Storage on a daily basis.
- D. Go to GCP Console and export this information to Cloud SQL on a daily basis.
Correct answer: A
Explanation
Option A is correct because it properly uses gcloud config to manage multiple configurations for accessing the compute instances in both projects. The other options are incorrect as they either use the wrong command (gsutil) which is not applicable for listing compute instances, or they suggest exporting data to Cloud Storage or Cloud SQL, which does not fulfill the requirement of listing instances directly.