What should a Compute Engine hosted application do to securely authenticate to a Cloud Pub/Sub topic in a different project?

Disable ads (and more) with a premium pass for a one time $4.99 payment

Prepare for the Google Cloud Professional Cloud Developer Test. Benefit from mock assessments featuring flashcards and multiple-choice format, each furnished with hints and detailed explanations. Excel in your exam with confidence!

In this scenario, the optimal approach is to configure the Compute Engine instances with a service account owned by project A and grant this service account publishing rights to the Cloud Pub/Sub topic located in project B. This ensures that the application can securely authenticate to the Pub/Sub service while adhering to best practices regarding service account usage and permissions.

Service accounts are critical for managing access control in Google Cloud environments. By using a service account associated with the same project as the Compute Engine instances, the application can obtain the necessary authentication tokens without needing to expose private keys or introduce additional complexities. This direct association increases security as it minimizes the surface area for potential credential leaks or misuse.

The service account should be permitted to act as a publisher on the topic in project B. This cross-project authentication is achieved through Google Cloud's Identity and Access Management (IAM) policies, enabling the service account from project A to invoke operations on the resources of project B securely.

Configuring Application Default Credentials or using the private keys of service accounts from project B or project A, as suggested in the other options, introduces additional risks and complexities. It may also violate the principle of least privilege if done improperly. By strictly utilizing the service account from project A and managing its permissions appropriately, the application can

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy