Medium1 markMultiple Choice
Domain 5.2: Managing service accountsDomain 5.2Service AccountsSecurityCompute Engine

GCP ACE · Question 46 · Domain 5.2: Managing service accounts

You have an application running on a Compute Engine VM that needs to read files from a specific Cloud Storage bucket.

What is the MOST secure way to grant the VM access to the bucket?

Answer options:

A.

Generate a service account JSON key, place it on the VM, and configure the application to use it.

B.

Use the default Compute Engine service account and grant it the 'Project Editor' role.

C.

Create a custom service account, grant it the 'Storage Object Viewer' role, and attach it to the VM.

D.

Make the Cloud Storage bucket public.

How to approach this question

Identify the best practice for granting VMs access to GCP resources.

Full Answer

C.Create a custom service account, grant it the 'Storage Object Viewer' role, and attach it to the VM.✓ Correct
The most secure way to grant a Compute Engine VM access to GCP APIs is to create a dedicated, custom service account with only the specific permissions needed (least privilege), and attach that service account to the VM. The metadata server automatically provides short-lived, rotating credentials to the application, eliminating the need to manage static JSON keys.

Common mistakes

Downloading JSON keys to VMs, which is an anti-pattern for workloads running inside GCP.

Practice the full GCP Associate Cloud Engineer Practice Exam 4

50 questions · hints · full answers · grading

More questions from this exam