An external security auditor needs read-only access to inspect Compute Engine instance configurations, network interface details, and instance metadata within a specific Google Cloud project named `retail-store-prod`. The auditor must not be permitted to make modifications to any compute resources or access resources outside of this project. Following the principle of least privilege, which IAM role configuration should be granted to the auditor?
- Grant the `roles/compute.viewer` predefined role on the `retail-store-prod` project.Answer
- BGrant the `roles/viewer` primitive role on the `retail-store-prod` project.
- CGrant the `roles/compute.viewer` predefined role on the parent Folder containing the project.
- DGrant the `roles/compute.admin` predefined role on the `retail-store-prod` project.
Answer
Grant the `roles/compute.viewer` predefined role bound specifically at the `retail-store-prod` project level.
The correct answer adheres to the principle of least privilege by combining a service-specific predefined role (`roles/compute.viewer`) with the exact scope requested (project level). This ensures the security auditor can inspect Compute Engine instances without gaining access to non-compute services or other projects in the resource hierarchy.
Step-by-Step Solution
Key Concept
Principle of Least Privilege with Predefined Roles and Resource Hierarchy Scoping
Estimated Time:1m 30s