Courseiva

Google PCA Designing for Security and Compliance Practice Question

A developer wants to allow a Compute Engine VM to authenticate to Google Cloud APIs without embedding service account keys in the VM image. What is the recommended approach?

⚠ Common exam trap

Candidates often confuse service account impersonation with direct attachment; candidates may think impersonation is needed for VMs, but impersonation is for users or services acting as another identity, not for a VM's native authentication.

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

✓

Attach a service account to the VM instance

Attaching a service account to a Compute Engine VM instance is the recommended approach because it provides the VM with automatically rotated, short-lived credentials via the metadata server. Applications on the VM can call the metadata server to obtain access tokens without any key files. This eliminates the risk of key leakage and manual rotation.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • ✗

    Use Cloud KMS to encrypt a service account key and store it in a bucket

    Why it's wrong here

    Cloud KMS encrypts the key but the VM must still decrypt and load it, so a long-lived credential persists in the image or metadata. KMS protects data at rest, not workload identity; it suits encrypting buckets or disks, not removing keys from authentication.

  • ✗

    Use a service account impersonation flow

    Why it's wrong here

    Impersonation still requires a base credential on the VM to call the IAM Credentials API, so a secret remains embedded. It suits short-lived cross-project or human access, not the keyless metadata-server flow that attached service accounts provide.

  • ✓

    Attach a service account to the VM instance

    Why this is correct

    Attaching a service account to the VM lets Compute Engine supply short-lived credentials through the instance metadata server, so applications call Google Cloud APIs without embedded keys. This removes the key distribution and rotation risk that static service account keys in images create.

  • ✗

    Create a service account key and store it in the VM's startup script

    Why it's wrong here

    Storing a key in the startup script embeds a long-lived credential in the instance, exactly what the stem forbids. Startup scripts suit bootstrapping configuration; attached service accounts supply tokens via the metadata server with no key material at all.

About these practice questions

This PCA question is part of Courseiva's 807-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written and reviewed by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

Last reviewed September 2026 · checked against the official Google Cloud exam blueprint

This PCA practice question is part of Courseiva's free Google Cloud certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the PCA exam.