Google Professional Cloud Developer Question 425
Select 3Google Cloud PlatformYou are developing a serverless application on Google Cloud that integrates with multiple Google Cloud APIs, including the Cloud Storage API and the Pub/Sub API. To ensure secure API access, what steps should you take when configuring your application?
- A
Use a service account with only the necessary IAM roles for the APIs your application needs to access.
- B
Hardcode the API keys for each Google Cloud API directly into your application code for convenience.
- C
Leverage Application Default Credentials (ADC) to authenticate your application with Google Cloud APIs.
- D
Grant your service account the Owner role to ensure access to all required resources.
- E
Use the Cloud Client Libraries to interact with the Google Cloud APIs instead of making raw HTTP requests.
Show answer and explanation
Correct answers: A, C, E
Explanation
To securely integrate your application with Google Cloud APIs, you should follow Google-recommended best practices. These include using a service account with the least privileged IAM roles, leveraging Application Default Credentials (ADC) for authentication, and using Cloud Client Libraries for API interactions. Avoid hardcoding API keys and assigning overly permissive roles to your service accounts.
- A. Correct.
Correct. Using a service account with only the necessary IAM roles is a best practice for following the principle of least privilege, ensuring your application has only the permissions it needs.
- B. Incorrect.
Incorrect. Hardcoding API keys in your application code is a poor security practice that can lead to credential leakage and unauthorized access.
- C. Correct.
Correct. Application Default Credentials (ADC) is the recommended way to authenticate your application with Google Cloud APIs as it simplifies the process and securely integrates with the execution environment.
- D. Incorrect.
Incorrect. Granting a service account the Owner role is not recommended as it provides excessive permissions, violating the principle of least privilege.
- E. Correct.
Correct. Using Cloud Client Libraries simplifies interaction with Google Cloud APIs, providing built-in authentication and retry mechanisms.