A site reliability engineer needs read-only access to inspect the configuration, state, and metadata of Compute Engine Virtual Machine (VM) instances in a specific project named `proj-prod-analytics`. The engineer must not be granted permissions to modify VM configurations, start or stop instances, or access instance serial console logs. Following Google Cloud recommended security practices, which IAM role binding should you apply?
- Assign the Compute Viewer role (roles/compute.viewer) bound directly to the user on the proj-prod-analytics project.Answer
- BAssign the Editor role (roles/editor) bound directly to the user on the proj-prod-analytics project.
- CAssign the Compute Viewer role (roles/compute.viewer) bound to the user at the Organization node level containing proj-prod-analytics.
- DAssign the Viewer role (roles/viewer) bound directly to the user on the proj-prod-analytics project.
Answer
Assign the Compute Viewer role (`roles/compute.viewer`) on the `proj-prod-analytics` project resource.
Binding the predefined `roles/compute.viewer` role directly at the target project level provides exact read-only permissions for Compute Engine instances without granting unnecessary privileges across other Google Cloud services or other projects.
Step-by-Step Solution
Key Concept
Applying least-privilege predefined roles at the appropriate resource hierarchy level.