IAM: the basics
Google Cloud IAM controls who (identity) can do what (role) on which resource. Every permission check follows this identity + role + resource pattern. You almost never grant permissions directly - you grant roles, and roles bundle permissions together.
Identities can be Google accounts, service accounts, Google groups, Cloud Identity domains, or 'allUsers'/'allAuthenticatedUsers' for public access. Prefer groups over individual users for easier management at scale.
Role types
- Basic roles: Owner, Editor, Viewer. Broad, legacy, apply project-wide - avoid in production, too permissive.
- Predefined roles: curated by Google per service, e.g. roles/compute.instanceAdmin. Best practice for most cases.
- Custom roles: you define the exact permission set. Useful for least privilege but need maintenance as APIs change.
The resource hierarchy
Policies flow downward: Organisation > Folder > Project > Resource. A role granted at the organisation level is inherited by every folder, project and resource beneath it. You cannot restrict a permission lower down that was granted higher up - only add more. Deny policies (a separate feature) can block access regardless of allow policies, and deny always wins over allow.
Service accounts
A service account is an identity for applications/VMs, not a person. Each has an email like PROJECT_NUMBER-compute@developer.gserviceaccount.com (default Compute Engine SA) or name@project.iam.gserviceaccount.com. Avoid using the default service account with the broad Editor role in production - assign a custom SA with minimal roles instead. Service account keys (JSON) are a security risk if leaked - prefer attaching SAs directly to resources or using Workload Identity Federation instead of downloading keys.
Common mistakes to know for the exam
- Confusing Owner (full control incl. billing/IAM) with Editor (modify resources, no IAM/billing changes) with Viewer (read-only).
- Forgetting that IAM policies are additive across the hierarchy - there is no explicit lower-level 'deny' in a normal allow policy.
- Granting roles at project level when only one resource needs access - always scope to the smallest level that works.
- Leaving default service accounts with Editor role attached to VMs.
- Not knowing that Cloud IAM Recommender can suggest removing unused/excess permissions.
Useful tools
- Policy Analyzer / Policy Troubleshooter: work out why a user has or lacks access.
- IAM Conditions: add attribute-based conditional access (e.g. time-bound or resource-tag-bound grants) to a role binding.
- Organisation Policy Service: restricts what CAN be configured (e.g. disable external IPs) - separate from IAM, which controls WHO can act.
What three basic roles exist in Cloud IAM?
Owner, Editor, Viewer
tap to reveal
Which basic role includes billing and IAM management rights?
Owner
tap to reveal
What is the resource hierarchy order in Google Cloud, top to bottom?
Organisation > Folder > Project > Resource
tap to reveal
Do IAM policies granted higher in the hierarchy get inherited lower down?
Yes, they are inherited and cannot be restricted lower down, only added to
tap to reveal
What wins when an allow policy and a deny policy conflict?
The deny policy always wins
tap to reveal
What is a service account used for?
It is an identity for applications, VMs or workloads to authenticate and act, not for a human user
tap to reveal
What is the default Compute Engine service account email format?
PROJECT_NUMBER-compute@developer.gserviceaccount.com
tap to reveal
Why should you avoid downloading service account JSON keys?
Keys can leak and grant persistent access; prefer attaching the SA to the resource or using Workload Identity Federation
tap to reveal
What does the identity allUsers grant?
Public, anonymous access to anyone on the internet
tap to reveal
What does allAuthenticatedUsers grant?
Access to anyone with any Google account, not just your organisation
tap to reveal
When should you use a predefined role over a custom role?
By default - predefined roles are Google-curated and cover most needs; use custom roles only when you need tighter least-privilege control
tap to reveal
What tool suggests removing excess or unused IAM permissions?
IAM Recommender
tap to reveal
What feature lets you add time-bound or attribute-based restrictions to a role binding?
IAM Conditions
tap to reveal
What is the best-practice scope level to grant an IAM role?
The smallest scope in the hierarchy that satisfies the requirement (least privilege)
tap to reveal
What separate service restricts what configurations are allowed, rather than controlling who can act?
Organisation Policy Service
tap to reveal