VMs push batches of sensitive transactions to Cloud Pub/Sub. What is the Google-recommended authentication method for the application running on the VMs?
Choose an answer
Tap an option to check your answer.
Correct answer: Ensure that VM service accounts are granted the appropriate Cloud Pub/Sub IAM roles..
Why this is the answer
The recommended and most secure method for applications running on Google Cloud VMs to authenticate to other Google Cloud services like Cloud Pub/Sub is by using VM service accounts. When a service account is attached to a VM, applications running on that VM automatically use the service account's credentials to make API calls to Google Cloud services. Granting the appropriate IAM roles to this service account ensures the application has the necessary permissions without requiring explicit credential management within the application code or on the VM itself. Incorrect options: VM access scopes define the default OAuth scopes for the VM, but IAM roles on the service account are the primary and more granular way to control access to specific resources and actions. Generating and storing OAuth2 tokens manually is less secure, more complex to manage, and prone to expiration issues compared to using service accounts. Creating a Cloud Function gateway adds unnecessary latency, complexity, and cost, and is not the standard or most efficient way to grant access from a VM to Pub/Sub.
Pass your exam — without the endless answer hunt
Get every verified question and explanation for this exam in one place, and save hours of prep. 1,000+ certifications · 20+ languages · free to start.
Pass your exam faster → No card needed