List Compute Instances in Google Cloud Platform Projects | Automated Daily Process

List of Compute Instances in Development and Production Projects

Question

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?

Answers

Explanations

Click on the arrows to vote for the correct answer

A. B. C. D.

A.

The recommended approach to list all compute instances in both development and production projects on a daily basis is to create two configurations using gcloud config and then write a script that sets configurations as active, individually. For each configuration, use gcloud compute instances list to get a list of compute resources. Therefore, option A is the correct answer.

Here is a detailed explanation of each option and why they are correct or incorrect:

Option 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.

This option suggests using the gcloud command-line tool to create two configurations: one for the production project and another for the development project. Then, a script is written that sets each configuration as active individually and uses the gcloud compute instances list command to get a list of compute instances in each project. This option is the best approach since it uses a tool specifically designed for managing Google Cloud Platform resources and provides a flexible and efficient way to gather the required information.

Option 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.

This option suggests using the gsutil command-line tool to create two configurations: one for the production project and another for the development project. However, gsutil is a tool for managing Google Cloud Storage resources, not compute instances. Therefore, this option is incorrect.

Option C: Go to Cloud Shell and export this information to Cloud Storage on a daily basis.

This option suggests using Cloud Shell to export the information to Cloud Storage. However, it does not specify how to get the information for both development and production projects. Therefore, this option is incorrect.

Option D: Go to GCP Console and export this information to Cloud SQL on a daily basis.

This option suggests using the GCP Console to export the information to Cloud SQL. However, it does not specify how to get the information for both development and production projects. Therefore, this option is incorrect.