GOOGLE-PROFESSIONAL-CLOUD-DEVELOPER practice question 25 of 35
Your application requires service accounts to be authenticated to GCP products via credentials stored on its host Compute Engine virtual machine instances. You want to distribute these credentials to the host instances as securely as possible. What should you do?
Full set: 265 questionsThe most secure and recommended method for an application on a Compute Engine instance to authenticate to other Google Cloud services is by using the instance's attached service account. The Google Cloud client libraries automatically use Application Default Credentials (ADC) to find these credentials. ADC retrieves short-lived access tokens from the instance metadata server, eliminating the need to manually manage, distribute, or rotate static credential files (like JSON or P12 keys). This approach minimizes the risk of key exposure and adheres to the principle of least privilege by binding the identity directly to the compute resource.
A. Signed URLs grant time-limited access to a specific Cloud Storage object. They are not a general mechanism for authenticating a service to multiple GCP products.
C. Generating and copying a P12 file (a static, long-lived credential) is less secure. It creates a secret that must be managed, rotated, and protected from compromise.
D. Committing any credentials or secrets into a source code repository is a major security anti-pattern that exposes them to anyone with access to the repository's history.
1. Google Cloud Documentation, "Authenticate as a service account": "For applications running on Google Cloud, we recommend that you don't use service account keys. Instead, you can use the credentials of the service account that is attached to the resource." This document explicitly recommends the method in option B over methods like option C.
2. Google Cloud Documentation, "Application Default Credentials (ADC)": "When your code is running on a Google Cloud resource such as a Compute Engine virtual machine (VM)... ADC can use the service account that is attached to the resource." This confirms that ADC is the mechanism for using the attached service account.
3. Google Cloud Documentation, "Best practices for working with service accounts", Section: "Avoid using service account keys when an alternative is available": "Service account keys are a security risk if they are not managed correctly... When your code runs on Google Cloud infrastructure, such as Compute Engine VMs, you can often use the default service account credentials instead of a service account key." This directly contrasts the correct approach (B) with the insecure one (C).
4. Google Cloud Documentation, "Overview of signed URLs": "A signed URL is a URL that provides limited permission and time to make a request... Signed URLs are most often used to give a user temporary access to a specific resource." This reference clarifies the specific, limited use case for signed URLs, showing why option A is incorrect for general service authentication.
Keep practicing
Take the free GOOGLE-PROFESSIONAL-CLOUD-DEVELOPER practice test
Ten exam-style questions with answers and explanations, plus the exam facts and study guides.
More questions
Other GOOGLE-PROFESSIONAL-CLOUD-DEVELOPER practice questions
- Question 1You have an application controlled by a managed instance group. When you deploy a new ver…
- Question 2Your service adds text to images that it reads from Cloud Storage. During busy times of t…
- Question 3You have been tasked with planning the migration of your company’s application from on-pr…
- Question 4You plan to make a simple HTML application available on the internet. This site keeps inf…
- Question 5HipLocal's APIs are showing occasional failures, but they cannot find a pattern. They wan…
- Question 6Your company has created an application that uploads a report to a Cloud Storage bucket. …
