What Is GCP IAM and How Does It Work?
Google Cloud IAM is the permission system for every Google Cloud resource. Each access decision connects four elements:| Component | What it means | Example |
|---|---|---|
| Principal | Who is requesting access | A developer, a Google group, or a service account |
| Permission | One specific action | compute.instances.get (view a VM) |
| Role | A named bundle of permissions | Compute Viewer (roles/compute.viewer) |
| Resource | What is being accessed | An organization, folder, project, VM, or bucket |
A Simple Example
Imagine a company with three employees:Developer: Needs to view Compute Engine instances.
Database administrator: Needs to manage one Cloud SQL database.
Finance analyst: Needs to review cloud billing.
With IAM, each person gets a role that matches the job. The developer gets Compute Viewer, the database administrator gets Cloud SQL Admin on that database’s project, and the finance analyst gets Billing Account Viewer. Nobody can touch what they do not need.
Types of GCP IAM Roles
An IAM role is a collection of permissions. Google Cloud has three types: basic, predefined, and custom.1. Basic Roles
Basic roles are the original, project-wide roles. They cover almost every service at once.| Role | Role ID | What it allows |
|---|---|---|
| Viewer | roles/viewer | Read most resources in the project |
| Editor | roles/editor | Viewer access plus create, change, and delete most resources |
| Owner | roles/owner | Editor access plus managing IAM and billing for the project |
2. Predefined Roles
Predefined roles are built and maintained by Google for one service or job. They are the right default for most grants.| Role | Role ID | Purpose |
|---|---|---|
| Compute Viewer | roles/compute.viewer | View Compute Engine resources |
| Storage Object Viewer | roles/storage.objectViewer | Read Cloud Storage objects |
| Billing Account Viewer | roles/billing.viewer | View billing account cost and transaction data |
| Security Reviewer | roles/iam.securityReviewer | List all resources and their IAM policies |
3. Custom Roles
Custom roles contain only the permissions you choose. Use them when every predefined role gives too much access.For example, an internal dashboard may need compute.instances.list and nothing else. Compute Viewer includes far more, so a custom role with that single permission is the tighter fit.
The trade-off is maintenance. Google updates predefined roles when services change, but you must update custom roles yourself.
Which IAM Role Should You Choose?
| Situation | Role to grant | Scope |
|---|---|---|
| Developer needs to inspect VMs | Compute Viewer (roles/compute.viewer) | Project |
| App needs to read files in one bucket | Storage Object Viewer (roles/storage.objectViewer) | That bucket only |
| Finance analyst needs to see costs | Billing Account Viewer (roles/billing.viewer) | Billing account |
| Security team audits access | Security Reviewer (roles/iam.securityReviewer) | Organization |
| Internal tool needs one or two permissions | Custom role with only those permissions | Project |
| Someone needs full control of a sandbox | Owner (roles/owner) | That sandbox project only |
GCP IAM Permissions and Policies
A permission is one action on one type of resource. Permissions follow the format service.resource.verb.| Permission | What it allows |
|---|---|
| compute.instances.list | List Compute Engine instances |
| compute.instances.get | View one instance's details |
| compute.instances.stop | Stop an instance |
| storage.objects.get | Read a Cloud Storage object |
What Is an IAM Allow Policy?
An allow policy is attached to a resource and lists bindings. Each binding pairs one role with the principals who hold it.{
"bindings": [
{
"role": "roles/compute.viewer",
"members": [
"group:[email protected]"
]
}
]
}
Allow vs Deny vs Principal Access Boundary Policies
Google Cloud has three policy types. Only allow policies grant access. The other two only take it away.| Policy | What it does | Example |
|---|---|---|
| Allow | Grants roles to principals | Developers can view VMs in the project |
| Deny | Blocks specific permissions, even if a role grants them | Nobody except the platform team can delete projects |
| Principal Access Boundary (PAB) | Limits which resources a principal can ever be eligible to access | Contractors can only reach resources inside one folder |
Read more in Google’s IAM policy overview and deny policies guide.
How GCP IAM Permission Inheritance Works
Google Cloud organizes resources into a hierarchy: Organization → Folder → Project → Resource. A role granted at any level applies to everything below it.Example
A company has two folders, Engineering and Finance, each with its own projects. An admin grants the engineering group the Viewer role on the Engineering folder.That group can now view every project in the Engineering folder, including projects created next year. It gets nothing in the Finance folder, because Finance sits beside Engineering, not below it.
You Cannot Remove Inherited Access Lower Down
Allow policies only add access. If someone has Viewer at the organization level, removing them from a project’s IAM page does nothing, because the organization grant still applies.To take that access away, you have two options:
Remove the grant where it was made, at the organization or folder level.
Add a deny policy that blocks the specific permissions on that project.
Questions to Ask Before Granting a Role
Does this person need access to one resource or many projects?
Will the grant flow down to resources they should not see?
Will future projects in this folder inherit it automatically?
Could the same role work at a lower level?
How to Grant, Check, and Remove IAM Access in GCP
You can manage IAM through the Google Cloud Console, the gcloud CLI, or infrastructure as code tools like Terraform. You need a role with resourcemanager.projects.setIamPolicy, such as Project IAM Admin, to change a project’s policy.Method 1: Google Cloud Console
Open the Google Cloud Console and select the project.
Go to IAM & Admin → IAM.
Click Grant Access.
Enter the email of the user, group, or service account.
Choose the role, for example Compute Viewer.
Optionally, click Add IAM condition to limit when the grant applies.
Click Save.
Method 2: gcloud CLI
Grant a role on a project:gcloud projects add-iam-policy-binding PROJECT_ID \
--member="group:[email protected]" \
--role="roles/compute.viewer"
gcloud projects get-iam-policy PROJECT_ID \
--flatten="bindings[].members" \
--filter="bindings.members:user:[email protected]" \
--format="table(bindings.role)"
gcloud iam roles describe roles/compute.viewer
gcloud projects remove-iam-policy-binding PROJECT_ID \
--member="group:[email protected]" \
--role="roles/compute.viewer"
gcloud beta projects get-ancestors-iam-policy PROJECT_ID
--include-deny --format=json
Temporary Access: IAM Conditions and Privileged Access Manager
Google Cloud gives you two ways to grant access that does not last forever. Use IAM Conditions for planned, fixed windows. Use Privileged Access Manager for on-demand elevated access.IAM Conditions
IAM Conditions attach a rule to a role binding. The grant only applies while the rule is true.Example: a contractor needs Compute Viewer until December 1, 2026.
gcloud projects add-iam-policy-binding PROJECT_ID \
--member="user:[email protected]" \
--role="roles/compute.viewer" \
--condition='expression=request.time < timestamp("2026-12-01T00:00:00Z"),title=contractor-until-dec-1'
Common uses:
- Contractor or vendor access with an end date
- Access limited to resources whose names start with a prefix, such as dev-
- Access limited to resources with a specific tag
See the official IAM Conditions documentation.
Privileged Access Manager (PAM)
Privileged Access Manager handles just-in-time access. Instead of holding an admin role all the time, an engineer requests it when needed, an approver signs off, and the role is removed automatically after a set duration.PAM fits cases like an on-call engineer needing Compute Admin during an incident. It also logs every request and approval, which helps with audits.
What Are Service Accounts in GCP IAM?
A service account is an identity for an application or workload instead of a person. It receives IAM roles just like a user does.For example, a Cloud Run app that reads a BigQuery dataset runs as a service account with BigQuery Data Viewer on that dataset. (If you are sizing that workload, see our Cloud Run pricing guide.)
Example: A Reporting App
A reporting app needs to read files from one Cloud Storage bucket. A secure setup looks like this:Create a dedicated service account, such as reporting-app@PROJECT_ID.iam.gserviceaccount.com.
Grant it Storage Object Viewer on that one bucket, not on the project.
Attach the service account to the Cloud Run service or VM running the app.
Give it no write or admin roles.
Avoid Service Account Keys Where You Can
Downloaded JSON keys are the most common way service accounts leak. They never expire by default, and they end up in Git repos and laptops.Better options:
Attached service accounts: Code running on Google Cloud (Compute Engine, Cloud Run, GKE) gets short-lived credentials automatically.
Workload Identity Federation: Workloads outside Google Cloud, such as GitHub Actions, AWS, or Azure, exchange their own identity token for short-lived Google credentials. No key file needed.
Impersonation: Developers act as a service account temporarily using gcloud --impersonate-service-account, which is logged and requires the Service Account Token Creator role.
Service Account Best Practices
Use one service account per workload.
Never grant Editor or Owner to a service account.
Prefer attached service accounts and Workload Identity Federation over JSON keys.
Limit who holds Service Account User and Token Creator, since those roles let people act as the account.
Delete or disable unused service accounts.
How to Fix GCP IAM Permission Denied (403) Errors
A 403 Permission Denied error means Google Cloud recognized who you are but blocked the action. The error text usually names the exact permission that was missing, which is the fastest clue.A typical message looks like this:
Required 'compute.instances.get' permission for
'projects/my-project/zones/us-central1-a/instances/web-1'
The principal has no role containing that permission.
The role was granted on the wrong project, folder, or resource.
The request came from a different identity than expected, often a service account.
An IAM Condition is not met, for example the grant expired.
A deny policy blocks the permission.
A principal access boundary excludes that resource.
An organization policy or VPC Service Controls perimeter blocks the request.
Identify the principal. Check whether the request came from a user or a service account. Run gcloud auth list to see which identity your CLI is using.
Find the missing permission. Read it from the error message, such as compute.instances.get.
Find a role that contains it. Search the IAM roles reference for the permission, then pick the narrowest predefined role that includes it.
Check restrictions. Look for expired conditions, deny policies, and principal access boundaries that could still block the request.
Confirm with Policy Troubleshooter. Enter the principal, resource, and permission. It checks allow, deny, and principal access boundary policies and shows which one allows or blocks the request.
What You Should Avoid
Do not grant Owner or Editor to make a 403 go away. It fixes the error in seconds and leaves a security hole that can last for years. Grant the one role that contains the missing permission instead.GCP IAM Best Practices
These eight habits prevent most IAM problems.| Best practice | What to do |
|---|---|
| Follow least privilege | Grant only the permissions a job needs |
| Grant to groups, not people | Add users to Google groups and grant roles to the group, so access follows team changes |
| Use predefined roles | Avoid Owner, Editor, and Viewer in production |
| Grant at the lowest level | Prefer resource or project scope over folder or organization scope |
| Review inherited access | Check organization and folder grants, not just the project page |
| Act on IAM recommendations | Use IAM role recommendations , which flag permissions unused for 90 days and suggest smaller roles |
| Make elevated access temporary | Use IAM Conditions or Privileged Access Manager instead of permanent admin roles |
| Secure service accounts | One account per workload, no Editor, no long-lived keys |
The Minimum IAM Roles a FinOps Team Needs on GCP
Most companies give their FinOps and finance people either too little access (they wait on engineers for every report) or far too much (Billing Account Administrator for everyone). The fix is to split who can see cost data from who can change spending.Consider a company where:
A finance analyst needs billing reports and cost exports.
A cloud engineer manages Compute Engine resources.
A FinOps lead needs spend visibility, budgets, and commitment recommendations.
One approved person can purchase committed use discounts (CUDs).
| Person | Needs to | Roles to grant | Where |
|---|---|---|---|
| Finance analyst | View costs and invoices | Billing Account Viewer (roles/billing.viewer) | Billing account |
| Finance analyst | Query the billing export in BigQuery | BigQuery Data Viewer (roles/bigquery.dataViewer) + BigQuery Job User (roles/bigquery.jobUser) | Billing export dataset + its project |
| FinOps lead | Create budgets and alerts, manage exports | Billing Account Costs Manager (roles/billing.costsManager) | Billing account |
| FinOps lead | See spend-based CUD recommendations | Billing Account Commitment Recommender Viewer (roles/recommender.billingAccountCudViewer) | Billing account |
| FinOps lead | See existing resource-based commitments and VM usage | Compute Viewer (roles/compute.viewer) | Projects or folder |
| Cloud engineer | Create and manage VMs | Compute Instance Admin (roles/compute.instanceAdmin.v1) | Their projects only |
| Commitment buyer | Purchase resource-based CUDs | Custom role with compute.commitments.create, .get, .list | Projects that hold commitments |
| Commitment buyer | Purchase spend-based CUDs | Billing Account Administrator (roles/billing.admin) | Billing account, ideally via Privileged Access Manager |
To set up the finance analyst’s BigQuery access, first enable Cloud Billing export to BigQuery. For the commitment rows, our GCP committed use discounts guide explains how resource-based and spend-based CUDs work, and GCP Flex CUD vs resource-based CUDs helps you choose between them. Google’s CUD recommendations are a useful starting point for sizing.
How IAM Supports Cost Governance
IAM does not lower your cloud bill directly. It controls who can create the things that drive the bill. Used deliberately, it lets you:Limit who can create large or GPU instances in production projects.
Give finance full cost visibility without any infrastructure access.
Keep commitment purchases behind a small, audited group.
Give cost tools read-only access by default, with write access only where automation is approved.
Does GCP IAM Cost Money?
No. Google Cloud does not charge for IAM itself. Related services can have costs, such as storing Cloud Audit Logs beyond the free allotment or running BigQuery queries on exported IAM or billing data.How Usage.ai Uses IAM to Optimize GCP Commitments
Commitment management is a good example of least privilege in practice. A tool that recommends and manages CUDs needs to read your billing and usage data, but it should only purchase commitments where you have approved it.That is how Usage.ai connects to Google Cloud. A dedicated Usage.ai service account gets read access to your BigQuery billing export dataset, plus an organization-level role created by a script you run and review in Cloud Shell. The full steps are in the Usage.ai GCP integration guide.
You can start with a read-only Savings Test before any purchasing is authorized. Once enabled, Usage.ai manages eligible commitments through Autopilot or approval-based CoPilot, so you decide how much automation the service account is trusted with. Learn more about our GCP commitment optimization.
See how much you could save on eligible Google Cloud spend with Usage.ai's automated commitment management and risk protection.
Conclusion
GCP IAM decides who can do what in your Google Cloud environment. Getting it right comes down to a few habits: grant predefined roles to groups, attach them at the lowest level that works, remember that inherited access adds up and cannot be removed lower down, and make elevated access temporary.When a 403 appears, read the missing permission from the error and grant only that. For FinOps teams, the same principles let finance see every dollar while keeping the power to commit spending in a few accountable hands.
Frequently asked questions
What is IAM in GCP?
GCP IAM is Google Cloud's Identity and Access Management system. It controls which users, groups, and service accounts can access each resource and what actions they can take.
What are the three types of IAM roles in GCP?
Basic, predefined, and custom. Basic roles (Owner, Editor, Viewer) are broad, predefined roles are built by Google for specific services, and custom roles contain only the permissions you select.
What is the difference between IAM roles and permissions?
A permission is one action, such as compute.instances.get. A role is a bundle of permissions. You grant roles, never individual permissions.
What is the difference between Owner and Editor in GCP?
Editor can create, change, and delete most resources. Owner can do all of that plus manage IAM permissions and billing for the project.
How do I check IAM permissions in GCP?
For direct grants on a project, open IAM & Admin in the Console or run gcloud projects get-iam-policy. To see effective access, including inherited roles and deny policies, use Policy Troubleshooter or Policy Analyzer.