Prepare and test your skills

Prepare and test your skills

Free sample question with answers and detailed explanation below. The Associate Cloud Engineer practice bank has an additional 2,014 practice questions.Try 10 free realistic questions: instant score, no credit card, and no account required.
A developer is deploying an internal reporting application on a new Compute Engine virtual machine (VM). The application requires read-only access to objects inside a single Cloud Storage bucket named analytics-reports-prod.
The workload must not have access to any other buckets or services in the project, and the developer must be able to attach the identity to the VM while adhering to the principle of least privilege.
How should you configure the service account, permissions, and VM settings?
This approach relies on the Compute Engine default service account combined with a restrictive access scope (devstorage.read_only) to limit the VM's API operations, while granting the user the project-wide Editor basic role.
roles/editor) role on the project upon creation. Reusing default service accounts couples multiple disparate applications to a single shared identity.devstorage.read_only scope limits API requests to read-only operations across Cloud Storage generally, but it cannot restrict access to a specific bucket. The application would have read access to all readable buckets across the project.This approach might be acceptable in a temporary sandbox or quick proof-of-concept environment where rapid setup is preferred over access security and no sensitive buckets exist in the project.
Google Cloud strongly advises disabling automatic role grants for default service accounts and moving away from access scopes as an authorization boundary, using dedicated service accounts with fine-grained IAM policies instead.
This approach attempts to use the VM instance access scope (devstorage.read_only) as the primary mechanism to grant read access to Cloud Storage without assigning any IAM roles to the service account, while giving the developer the Service Account Admin (roles/iam.serviceAccountAdmin) role.
devstorage.read_only scope cannot restrict access to a single designated bucket; it applies universally to all Cloud Storage API calls made by that VM.iam.serviceAccounts.actAs). Granting Service Account Admin allows the developer to create, delete, and modify service accounts across the project, which is excessive.cloud-platform scope and manage all authorization via Cloud IAM.This configuration would not work in any scenario requiring Cloud Storage access because an identity without IAM roles cannot authorize API calls, regardless of what access scopes are specified.
Granting administrative roles like roles/iam.serviceAccountAdmin to regular developers introduces privilege escalation risks, as it allows modifying service accounts that may possess elevated project privileges.
This option creates a dedicated service account but assigns it the primitive Viewer (roles/viewer) role at the project level, while giving the developer the Service Account Token Creator (roles/iam.serviceAccountTokenCreator) role.
iam.serviceAccounts.actAs permission, provided by the Service Account User (roles/iam.serviceAccountUser) role. The Service Account Token Creator role only allows principals to mint short-lived credentials (like OAuth2 access tokens or OIDC ID tokens) and perform impersonation via the API or CLI, but does not allow attaching the service account to a VM.roles/iam.serviceAccountTokenCreator does not confer the iam.serviceAccounts.actAs permission required by the Compute Engine API during instance deployment.This configuration would be suitable if an automated supervisor script or external CI/CD runner needed to impersonate the service account to audit read-only configuration across the entire Google Cloud project.
When restricting permissions for workloads, predefined roles such as roles/storage.objectViewer applied at the resource level should always be preferred over basic roles applied at the project level.
In Google Cloud, workloads running on Compute Engine obtain identity and authorization by attaching a user-managed service account to the virtual machine (VM). Authorization is governed through Identity and Access Management (IAM) roles granted directly to that service account on target resources.
roles/storage.objectViewer) role directly on the specific bucket (analytics-reports-prod) guarantees that the VM cannot read or inspect any other buckets in the project.https://www.googleapis.com/auth/cloud-platform access scope delegates all authorization decisions to IAM. Because access scopes act as a legacy filter that restricts OAuth token capabilities, using the cloud-platform scope ensures the instance is not artificially constrained by VM-level scopes, allowing granular IAM policies to govern access.roles/iam.serviceAccountUser) role, which contains the iam.serviceAccounts.actAs permission. Granting this role specifically on the dedicated service account permits the developer to attach it to the VM without exposing broad administrative permissions across the project.cloud-platform access scope prevents authorization conflicts between access scopes and IAM policies.This configuration follows standard Google Cloud security guidelines by separating the service account identity, using fine-grained resource-level IAM roles, avoiding coarse access scopes, and granting only the precise actAs capability needed to deploy the instance.
Answer them yourself and get your score the moment you finish. No account needed.
Full access includes
Keep the momentum going with these hand-picked practice scenarios
Last updated