Question

Difficulty: EasyManaging IAM Roles and Resource Access Permissions

A cloud engineer needs to grant a user permissions to inspect the configuration and operational status of Compute Engine virtual machine instances within a specific Google Cloud project. The user should not be granted any capabilities to modify, start, stop, or delete instances, nor read access to other project services. Following Google Cloud recommended security best practices for least privilege access control, which IAM role should be assigned to the user?

  1. Compute Viewer (roles/compute.viewer)Answer
  2. B
    Project Viewer (roles/viewer)
  3. C
    Compute Admin (roles/compute.admin)
  4. D
    Project Editor (roles/editor)

Answer

Compute Viewer (roles/compute.viewer)
The Compute Viewer role (roles/compute.viewer) is a predefined role that grants read-only access to Compute Engine resources. It allows the user to view instance configurations and status without permitting modifications, instance state changes, or access to other services in the project, adhering strictly to the principle of least privilege.

Step-by-Step Solution

1
Analyze the access requirement
The target user requires read-only access limited specifically to Compute Engine virtual machines.
Identifying the specific service and permission scope prevents over-granting access.
2
Evaluate role types against Google Cloud best practices
Predefined roles should always be selected over broad primitive roles (Owner, Editor, Viewer).
Primitive roles apply project-wide permissions across all services, violating the principle of least privilege.
3
Select the optimal predefined role for the service
Compute Viewer (roles/compute.viewer) precisely allows viewing Compute Engine resources without granting modify rights or access to other GCP services.
This matches the exact scope required for the task.

Key Concept

Principle of Least Privilege using Predefined IAM Roles
Rate this question