You will have several applications running on different Compute Engine instances in the same project.
You want to specify at a more granular level the service account each instance uses when calling Google Cloud APIs.
What should you do?
Click on the arrows to vote for the correct answer
A. B. C. D.C.
In Google Cloud Platform (GCP), when you create a Compute Engine instance, you can specify a service account to associate with the instance. This service account is used by the instance when it needs to interact with other Google Cloud APIs or services. By default, Compute Engine instances are created with a default service account that has limited permissions.
However, in some cases, you may need to specify a more granular level of access for each instance, such as when different applications running on different Compute Engine instances require different levels of access to Google Cloud APIs.
To specify a more granular level of access, you can assign a specific service account to each instance. This can be done during the instance creation process by specifying the service account in the "Identity and API access" section of the instance creation form. You can also do this programmatically using the Compute Engine API.
Option A in the question is correct - when creating the instances, you should specify a Service Account for each instance. This will ensure that each instance has the appropriate level of access to the required Google Cloud APIs and services.
Option B is not the best approach because it assigns the name of each service account as instance metadata, which can be viewed by anyone with access to the instance. This approach can compromise the security of your instance and the service account associated with it.
Options C and D are not the best approach because they require updating the instance after it has been created, which can be time-consuming and error-prone. It's best to specify the service account when creating the instance to ensure that each instance has the appropriate level of access from the start.