Google Cloud · Concept

GCP IAM Explained — Roles, Service Accounts, and Policies

By CertSharp Team~19 min readLast updated

Free practice quiz

IAM is the most-tested topic on the ACE exam. Try it.

Drill roles, service accounts and policy inheritance with exam-style Google ACE questions. 30 free questions, no signup. Browse all Google Cloud certifications.

Take the free quiz

The Core Idea

GCP IAM answers the question “who can do what on which resource?” — by binding roles (which contain permissions) to principals (users, groups, service accounts) on a resource (organisation, folder, project, or specific resource). Once you know that one sentence, everything else is detail.

Google Cloud IAM is one of those topics where the marketing diagram looks simple and the practical reality is meaningfully nuanced. The exam tests both — the conceptual model and the practical edge cases. This guide explains what IAM is, the three role types, service accounts, Workload Identity, and the mistakes that catch otherwise-prepared engineers.

The IAM mental model

Every IAM decision is composed of three things:

  1. Principal — the “who.” A user, group, service account, or Workload Identity pool member.
  2. Role — the “what.” A collection of permissions (like storage.objects.get) bundled into a named role (like roles/storage.objectViewer).
  3. Resource — the “on which.” Where the binding applies: an organisation, a folder, a project, or a specific resource.

You combine these into an IAM binding: “principal X has role Y on resource Z.” A collection of bindings on a resource is its IAM policy. When a principal tries to perform an action, GCP evaluates every applicable binding and decides whether the action is allowed.

IAM is allow-only. There are no deny rules at the IAM level (other than the separate Org Policy / Deny Policies system, which is beyond ACE scope). If no binding grants the permission, the action is denied by default. If any applicable binding grants the permission, it is allowed.

Resource hierarchy and inheritance

GCP has a 4-level resource hierarchy:

Organization └── Folder (can nest up to 10 deep) └── Project └── Resource (VM, bucket, cluster, etc.)

IAM bindings inherit downward. A role granted at the organisation level applies to every folder, project, and resource beneath it. A role granted at project level applies to every resource in that project. A role granted at resource level applies to just that resource.

Bindings union. If you have roles/viewer at org level and roles/owner at project level, you effectively have roles/owner on that project. A lower-level binding cannot subtract a permission granted at a higher level.

Practical implication: apply IAM bindings at the smallest scope that works. Org-level admin grants are powerful and dangerous — one over-broad binding at org level affects every project beneath it.

Principals — the “who”

Principal types GCP recognises:

  • Google Account — an individual human user with a Google identity (Gmail, Workspace, or Cloud Identity).
  • Service Account — a non-human identity used by applications and workloads. Has an email address ending in @PROJECT_ID.iam.gserviceaccount.com (for user-managed) or various Google-managed patterns.
  • Google Group — a collection of Google Accounts. Binding a role to a group binds it to every current and future member. Preferred for human users at scale.
  • Google Workspace Domain — every user in a given Workspace domain.
  • Cloud Identity Domain — every user in a Cloud Identity domain.
  • allAuthenticatedUsers — any signed-in Google user. Use with extreme care.
  • allUsers — anyone on the internet, signed in or not. Use only for genuinely public resources (a Cloud Run service exposing a public API, a Cloud Storage bucket serving a public website).
  • Workload Identity Pool / Provider members — federated identities from external sources (AWS, Azure, OIDC providers).

Exam-relevant detail: Cloud Run public access requires the binding allUsers → roles/run.invoker. Without it, the service returns 403. Cloud Storage public objects require allUsers → roles/storage.objectViewer at the bucket level.

Roles — the “what”

A role is a named bundle of permissions. A permission has the form SERVICE.RESOURCE.VERB, e.g., compute.instances.create, storage.objects.get, iam.serviceAccounts.actAs.

You do not assign permissions to principals directly. You assign roles, which contain permissions. This is the same model AWS IAM and Azure RBAC use.

The three role types

1. Primitive roles (legacy, broad — use sparingly)

Three primitive roles, granted at project level:

  • Owner — full administrative access to all resources in the project, plus the ability to manage IAM.
  • Editor — read/write access to most resources but cannot manage IAM.
  • Viewer — read-only access to most resources.

These predate per-service roles and are intentionally broad. Google's guidance and the ACE exam both treat primitive roles as almost always the wrong answer in production. Use only for very small projects (e.g., a personal sandbox) or for short-lived emergency access.

2. Predefined roles (recommended)

Predefined roles are Google-curated bundles of permissions scoped to a specific service. There are hundreds. The naming convention is roles/SERVICE.PURPOSE:

  • roles/compute.instanceAdmin.v1 — full management of VMs.
  • roles/compute.viewer — read-only VM access.
  • roles/storage.objectViewer — read objects in Cloud Storage buckets.
  • roles/storage.objectCreator — write objects (no read).
  • roles/storage.admin — full bucket and object management.
  • roles/container.admin — full GKE administration.
  • roles/container.developer — deploy workloads but not manage clusters.
  • roles/iam.serviceAccountUser — use a service account (e.g., attach it to a VM).
  • roles/iam.serviceAccountTokenCreator — generate short-lived tokens for a service account (impersonation).
  • roles/cloudsql.client — connect to Cloud SQL instances.
  • roles/run.invoker — invoke a Cloud Run service.
  • roles/run.admin — manage Cloud Run services.
  • roles/logging.viewer — read logs in Cloud Logging.
  • roles/monitoring.viewer — read metrics in Cloud Monitoring.

Always prefer predefined roles when one fits. Google maintains them as new permissions are added to services, so you do not have to update your bindings as services evolve.

3. Custom roles (when nothing predefined fits)

Custom roles let you bundle an arbitrary set of permissions. You define the role at the organisation or project level, give it a name (roles/myCustomRole), and pick the exact permissions it contains.

Use custom roles when:

  • No predefined role matches your need without granting too much.
  • You want a precise least-privilege grant for a specific workflow. (background: Principle of Least Privilege and Defense in Depth)
  • You are building a delegated-admin model where specific teams manage specific functions.

Trade-off: you own the maintenance. When Google adds new permissions to a service, your custom role does not automatically pick them up. Predefined roles do.

Policies and bindings

An IAM policy is a list of bindings attached to a resource. In JSON:

{
  "bindings": [
    {
      "role": "roles/storage.objectViewer",
      "members": [
        "user:alice@example.com",
        "group:data-readers@example.com",
        "serviceAccount:reporter@my-project.iam.gserviceaccount.com"
      ]
    },
    {
      "role": "roles/storage.admin",
      "members": ["user:bob@example.com"]
    }
  ],
  "etag": "BwWWja0YfJA=",
  "version": 3
}

etag prevents concurrent edits from clobbering each other. If you GET a policy, modify it, and PUT it back, GCP rejects the PUT if the etag has changed in the meantime.

To modify a policy via gcloud, use:

gcloud projects add-iam-policy-binding PROJECT_ID \ --member="user:alice@example.com" \ --role="roles/storage.objectViewer"

gcloud handles the get-modify-put flow automatically. For organisation- or folder-level bindings, use gcloud organizations add-iam-policy-binding or gcloud resource-manager folders add-iam-policy-binding.

Service accounts in depth

A service account (SA) is a non-human identity used by workloads. SAs have email addresses, are themselves resources within a project, and can be granted IAM roles on other resources. The key distinction from human users: SAs are used by code, not by people.

Service account types

  • User-managed SAs — you create them, name them, and manage their lifecycle. Use for production workloads.
  • Default SAs — created automatically when you enable certain services. The Compute Engine default SA is the most-known example. Avoid using default SAs for production workloads — they have broad default permissions.
  • Google-managed SAs — used by Google services to act on your behalf. You do not manage these directly.

How code authenticates as a service account

Three patterns, in order of preference:

  1. Attach the SA to a compute resource. A VM with an attached SA gets credentials automatically through the metadata server. Cloud Run services and Cloud Functions get credentials the same way. No keys involved.
  2. Workload Identity (for GKE specifically). Bind a Kubernetes SA to a Google SA; pods get short-lived tokens through the metadata service. No keys.
  3. Service account impersonation. A user or another SA gets short-lived tokens for the target SA via the IAM API. Useful for developers running gcloud locally without long-lived keys.

JSON service-account keys are the legacy option and should be avoided. If a question shows a developer downloading a JSON key, the right answer almost always involves replacing that with one of the three patterns above.

Workload Identity (GKE)

Workload Identity is the recommended way for GKE pods to authenticate to GCP APIs. It establishes a trust relationship between a Kubernetes service account (KSA) and a Google service account (GSA): pods running as the KSA receive short-lived tokens that authenticate as the GSA.

The setup, conceptually:

  1. Enable Workload Identity on the GKE cluster (--workload-pool=PROJECT_ID.svc.id.goog).
  2. Create a GSA and grant it the GCP roles the workload needs.
  3. Create a KSA in the pod's namespace.
  4. Bind the KSA to the GSA: grant the KSA the roles/iam.workloadIdentityUser role on the GSA.
  5. Annotate the KSA with iam.gke.io/gcp-service-account=GSA_EMAIL.
  6. Run pods with serviceAccountName: KSA_NAME.

Pods now make GCP API calls authenticated as the GSA, with credentials rotated automatically. No JSON keys, no manual credential management.

Service account impersonation

Two principals are involved in impersonation:

  • The caller — a user or SA that wants to act as the target SA temporarily.
  • The target SA — the SA whose identity will be used.

The caller must have roles/iam.serviceAccountTokenCreator on the target SA. With that binding, the caller can request short-lived access tokens (typically 1-hour) for the target SA, and use those tokens to make API calls.

Common gcloud usage:

gcloud auth login  # as your user gcloud storage cp file.txt gs://prod-bucket/ \ --impersonate-service-account=deploy-sa@my-project.iam.gserviceaccount.com

This is the modern alternative to downloading deploy SA JSON keys. Developers authenticate as themselves; specific operations run as the deploy SA via impersonation.

Conditional bindings

IAM bindings can include conditions that restrict when the binding applies. Conditions use Common Expression Language (CEL) and can reference attributes like request time, resource name, or resource type.

Example: grant access only during business hours:

{
  "role": "roles/compute.instanceAdmin",
  "members": ["user:alice@example.com"],
  "condition": {
    "title": "Business hours only",
    "expression": "request.time.getHours('America/Los_Angeles') >= 9 && request.time.getHours('America/Los_Angeles') < 18"
  }
}

Common uses on the exam:

  • Time-bounded access (temporary admin grants that auto-expire).
  • Resource-name conditions (only buckets matching a name pattern).
  • Resource-type conditions (only Compute Engine VMs, not GKE clusters).

Best practices (and the exam expects these)

  1. Prefer predefined over primitive roles. Owner/Editor/Viewer should be a red flag.
  2. Bind to groups, not individuals. Manage group membership outside of IAM bindings.
  3. Use the smallest scope that works. Resource > project > folder > organisation.
  4. Avoid JSON service-account keys. Use direct attachment, Workload Identity, or impersonation.
  5. Use Workload Identity for GKE always, not the node SA.
  6. Do not use default service accounts for production workloads. Create user-managed SAs.
  7. Audit IAM regularly. Cloud Asset Inventory and IAM Recommender flag over-privileged bindings.
  8. Use conditional bindings for time-bounded or scope-narrowed access.
  9. Separate the “who can use the SA” binding from the “what the SA can do” binding. roles/iam.serviceAccountUser on the SA controls who can act as it. Roles on other resources control what it can do.

Real-world examples

Example 1: A Cloud Run service that reads from a Cloud Storage bucket

  1. Create a user-managed SA: app-sa@my-project.iam.gserviceaccount.com.
  2. Grant the SA roles/storage.objectViewer on the bucket only (not project-wide).
  3. Deploy Cloud Run with the SA: gcloud run deploy --service-account=app-sa@....
  4. Cloud Run gets credentials automatically via the metadata server. No keys involved.

Example 2: A developer running terraform that needs to provision GCP resources

  1. Create a deploy SA: terraform-deploy@my-project.iam.gserviceaccount.com.
  2. Grant the deploy SA the predefined roles it needs (e.g., roles/compute.networkAdmin, roles/iam.serviceAccountAdmin).
  3. Grant the developer roles/iam.serviceAccountTokenCreator on the deploy SA.
  4. Developer runs gcloud auth login as themselves, then uses impersonation when running terraform: gcloud auth application-default login --impersonate-service-account=terraform-deploy@....
  5. No JSON keys. Developer audit trail preserved.

Example 3: A GKE pod that needs to write to BigQuery

  1. Enable Workload Identity on the cluster.
  2. Create a GSA: bq-writer@my-project.iam.gserviceaccount.com.
  3. Grant the GSA roles/bigquery.dataEditor on the target dataset.
  4. Create a KSA in the pod's namespace.
  5. Grant the KSA roles/iam.workloadIdentityUser on the GSA.
  6. Annotate the KSA with the GSA email.
  7. Run the pod with that KSA. The pod authenticates to BigQuery as the GSA, with no keys.

Common ACE exam traps

  1. Primitive role as the “easy” answer. If you see roles/owner or roles/editor in options, suspect a trap. Predefined or custom roles are almost always the expected answer.
  2. JSON key as a “solution.” Any answer involving “download a JSON key” is almost always wrong. Look for Workload Identity, impersonation, or direct attachment.
  3. Org-level binding when project-level works. If a scenario asks for the least-privilege grant, project- or resource-level beats org-level.
  4. Default SA used in production. Default SAs have broad permissions. Production answers should use user-managed SAs.
  5. OS Login confusion. When OS Login is enabled, SSH keys in metadata are ignored. SSH access is controlled by roles/compute.osLogin (and roles/compute.osAdminLogin for sudo).
  6. Confusing “use this SA” with “manage this SA.” roles/iam.serviceAccountUser lets you act as the SA. roles/iam.serviceAccountAdmin lets you manage the SA (rotate keys, delete it). These are different roles for different purposes.

What is the difference between basic, predefined and custom roles?

Google's current documentation calls the legacy Owner, Editor and Viewer roles basic roles; older material (and this article above) calls them primitive roles. They are the same thing. Here is the comparison in one table:

Basic rolesPredefined rolesCustom roles
Who maintains themGoogleGoogle (updated as services add permissions)You
GranularityVery coarse: across nearly all servicesPer service or job functionExactly the permissions you pick
Exampleroles/editorroles/storage.objectViewerYour own role containing only the permissions a workflow needs
Production useAvoidDefault choiceWhen no predefined role fits
Exam default answerAlmost neverUsuallyOnly when the stem says nothing predefined fits

Which IAM roles control service accounts? A reference table

Four roles cause most of the confusion in both real projects and exam questions. They answer four different questions about a service account: who may use it, who may manage it, who may mint tokens for it, and which workloads may assume it.

RoleWhat it allowsBind it onTypical granteeWatch out for
roles/iam.serviceAccountUserAct as the service account (permission iam.serviceAccounts.actAs), for example to attach it to a VM, Cloud Run service or Cloud FunctionThe target service account (not the whole project, if you can avoid it)Developers and deploy pipelines that create resources which run as that SAGranting it at project level lets the holder act as every service account in the project
roles/iam.serviceAccountAdminCreate, update, delete and list service accounts, and manage who can use them (including its IAM policy)ProjectPlatform or identity adminsDoes not include actAs, but because it can change a service account's IAM policy it can be used to escalate; treat it as sensitive
roles/iam.serviceAccountTokenCreatorGenerate short-lived access tokens, ID tokens and signed blobs for a service account: the basis of impersonationThe target service accountDevelopers or automation that must run commands as that SA without keysWhoever holds it effectively holds the SA's permissions, so audit it like the SA itself
roles/iam.workloadIdentityUserLets a Kubernetes service account (GKE Workload Identity) or an external federated identity impersonate the Google service accountThe Google service accountThe workload identity principal, for example serviceAccount:PROJECT_ID.svc.id.goog[NAMESPACE/KSA_NAME]Binding is on the GSA and names the KSA as the member; people often bind it on the wrong side
roles/iam.serviceAccountKeyAdminCreate and delete user-managed keys for service accountsProject or the SAAlmost nobody; disable key creation by policy where possibleKeys are long-lived credentials and the main source of service account leaks
roles/iam.serviceAccountCreatorCreate new service accounts but not use or manage existing onesProjectAutomation that provisions new workload identitiesPair with a separate step that grants only the roles each new SA needs

A mnemonic for the first three: User uses, Admin manages, TokenCreator impersonates. WorkloadIdentityUser is the odd one out: it is how a non-Google identity (a Kubernetes service account, a GitHub Actions workflow, an AWS role) is allowed in.

Which role do I need for this task?

TaskRole and where to bind it
Deploy a Compute Engine VM that runs as an existing service accountroles/iam.serviceAccountUser on that service account, plus roles/compute.instanceAdmin.v1 on the project
Deploy a Cloud Run service with a specific runtime service accountroles/iam.serviceAccountUser on the runtime SA, plus roles/run.admin (or developer) on the project
Run gcloud commands as a deploy service account without a keyroles/iam.serviceAccountTokenCreator on the deploy SA
Let a GKE pod call BigQueryroles/iam.workloadIdentityUser on the Google SA, granted to the Kubernetes SA member; BigQuery roles granted to the Google SA
Let a CI system outside Google Cloud deploy without keysWorkload Identity Federation: roles/iam.workloadIdentityUser on the SA for the external identity
Let a platform team create and delete service accountsroles/iam.serviceAccountAdmin (or serviceAccountCreator for create-only) on the project
Let a service read one bucketroles/storage.objectViewer on that bucket, granted to the service account

What are the best practices for GCP service accounts?

Service accounts are the most common source of real-world Google Cloud credential leaks, because a leaked key works from anywhere until someone revokes it. These are the practices that matter most, in priority order:

  1. Do not create keys unless nothing else works. Prefer attaching the SA to the resource, Workload Identity for GKE, Workload Identity Federation for external systems, and impersonation for humans.
  2. Block key creation with Organization Policy. The iam.disableServiceAccountKeyCreation constraint prevents user-managed key creation and is an effective guardrail. Grant exceptions at project level only when justified.
  3. Use one service account per workload. Sharing an SA between a web app and a batch job means a compromise of either gets the union of both permission sets.
  4. Do not use the default service accounts for production. The Compute Engine default SA is often granted the broad Editor role automatically in older projects; the iam.automaticIamGrantsForDefaultServiceAccounts constraint stops that behavior for new ones.
  5. Never grant basic roles to service accounts. Grant the narrowest predefined role on the narrowest resource.
  6. Restrict who can act as or impersonate the SA. serviceAccountUser and serviceAccountTokenCreator are powerful: bind them on the specific SA, to groups, with conditions where possible.
  7. Disable before you delete. If an SA looks unused, disable it first; if nothing breaks, delete it. Use IAM Recommender and policy analysis to find unused or over-privileged accounts.
  8. Give service accounts clear names. billing-export-reader tells reviewers more than sa-1.
  9. Watch audit logs. Cloud Audit Logs record who impersonated or created keys; alert on key creation and on grants of the powerful SA roles.
  10. If you must use a key, store it in Secret Manager or a CI secret store, rotate it on a schedule, and never commit it to a repository.

How is Workload Identity Federation different from GKE Workload Identity?

The two names are easy to mix up, and exam questions rely on that. Workload Identity (GKE) connects Kubernetes service accounts inside a GKE cluster to Google service accounts. Workload Identity Federation lets workloads running outside Google Cloud (AWS, Azure, GitHub Actions, on-premises systems using OIDC or SAML) exchange their own identity token for short-lived Google credentials, without a service account key. Both end with the same idea: short-lived tokens instead of downloaded JSON keys.

Workload Identity (GKE)Workload Identity Federation
Where the workload runsInside a GKE clusterOutside Google Cloud (AWS, Azure, GitHub, on-prem)
Identity sourceKubernetes service accountExternal identity provider token
Key configurationCluster workload pool and KSA annotationWorkload identity pool and provider with attribute mapping
Role that lets it inroles/iam.workloadIdentityUser on the GSAroles/iam.workloadIdentityUser on the GSA (or direct resource access for the federated principal)
ReplacesNode service account and keysDownloaded JSON keys for external systems

What do service account email addresses mean?

People search for strings like iam.gserviceaccount.com because every service account identity is an email, and the format tells you what kind of account it is.

PatternWhat it is
NAME@PROJECT_ID.iam.gserviceaccount.comA user-managed service account you create
PROJECT_NUMBER-compute@developer.gserviceaccount.comThe Compute Engine default service account
PROJECT_ID@appspot.gserviceaccount.comThe App Engine default service account
service-PROJECT_NUMBER@SERVICE.iam.gserviceaccount.comA Google-managed service agent used by a Google Cloud service acting on your behalf

In IAM bindings the member string is prefixed with serviceAccount:, for example serviceAccount:reporter@my-project.iam.gserviceaccount.com.

gcloud commands for service accounts and role bindings

# Create a user-managed service account
gcloud iam service-accounts create reporter \
  --display-name="Reporting service"

# Grant a role on a single bucket to the service account
gcloud storage buckets add-iam-policy-binding gs://my-reports-bucket \
  --member="serviceAccount:reporter@PROJECT_ID.iam.gserviceaccount.com" \
  --role="roles/storage.objectViewer"

# Let a developer attach/act as the service account (serviceAccountUser)
gcloud iam service-accounts add-iam-policy-binding \
  reporter@PROJECT_ID.iam.gserviceaccount.com \
  --member="user:alice@example.com" \
  --role="roles/iam.serviceAccountUser"

# Let a developer impersonate it (token creator)
gcloud iam service-accounts add-iam-policy-binding \
  reporter@PROJECT_ID.iam.gserviceaccount.com \
  --member="user:alice@example.com" \
  --role="roles/iam.serviceAccountTokenCreator"

# Workload Identity: let a Kubernetes SA use the Google SA
gcloud iam service-accounts add-iam-policy-binding \
  reporter@PROJECT_ID.iam.gserviceaccount.com \
  --role="roles/iam.workloadIdentityUser" \
  --member="serviceAccount:PROJECT_ID.svc.id.goog[NAMESPACE/KSA_NAME]"

# Audit: who can use this service account?
gcloud iam service-accounts get-iam-policy \
  reporter@PROJECT_ID.iam.gserviceaccount.com

# Audit: list its keys (ideally only system-managed ones)
gcloud iam service-accounts keys list \
  --iam-account=reporter@PROJECT_ID.iam.gserviceaccount.com

# Disable an unused service account before deleting it
gcloud iam service-accounts disable \
  reporter@PROJECT_ID.iam.gserviceaccount.com

Why do I get "permission denied" or "iam.serviceAccounts.actAs" errors?

  • Error mentions iam.serviceAccounts.actAs: the identity creating the resource lacks roles/iam.serviceAccountUser on the service account you tried to attach. Fix the binding on the service account, not the project.
  • Impersonation fails with 403: the caller needs roles/iam.serviceAccountTokenCreator on the target service account, and the IAM Service Account Credentials API must be enabled in the project.
  • GKE pod gets the node's identity instead of the Google SA: the KSA annotation is missing or Workload Identity is not enabled on the cluster or node pool.
  • Binding exists but access is still denied: check for an IAM deny policy, an Organization Policy constraint, or a condition that has expired. Remember that IAM changes can take a short time to propagate.

GCP IAM practice questions

1. A developer needs to deploy a Cloud Run service that runs as an existing service account. Which role do they need on that service account?

roles/iam.serviceAccountUser, bound on the service account. It grants the actAs permission needed to attach the identity.

2. A team wants developers to run Terraform as a deploy service account without downloading keys. What should they grant?

roles/iam.serviceAccountTokenCreator on the deploy service account, then use impersonation.

3. A GKE pod needs to read a Cloud Storage bucket. What is the recommended setup?

Enable Workload Identity, create a Google service account with roles/storage.objectViewer on the bucket, and grant the Kubernetes service account roles/iam.workloadIdentityUser on the Google service account.

4. A GitHub Actions workflow must deploy to Google Cloud. Which approach avoids long-lived secrets?

Workload Identity Federation with a workload identity pool and provider for GitHub, mapped to a service account via roles/iam.workloadIdentityUser.

5. Which role lets someone create and delete service accounts but not act as them?

roles/iam.serviceAccountAdmin.

6. A user has roles/viewer at the organization and no roles in a project. Can they edit resources in that project?

No. Viewer is read-only and is inherited downward; with no other binding granting write permissions, they cannot edit anything.

More scenario drills are in our Google ACE practice questions, and you can try the Associate Cloud Engineer practice exam free or compare options on the pricing page.

How does GCP IAM compare with AWS IAM?

If you know AWS, the closest mappings are: a GCP service account is similar to an AWS IAM role used by workloads; impersonation resembles assuming a role with STS; Workload Identity Federation is comparable to using OIDC federation into AWS; and GCP's resource hierarchy with inheritance contrasts with AWS accounts and Organizations. Security duties also split differently between provider and customer; the principle is explained in our shared responsibility model guide, and the same idea applies on Google Cloud.

Where does IAM fit in your ACE study plan?

IAM shows up in almost every ACE domain, so study it early. Our ACE study plan schedules it in the first week. If you are weighing the next step after ACE, ACE vs Professional Cloud Architect explains how IAM design questions get deeper at the professional level.

Frequently asked questions

What is the difference between a primitive, predefined, and custom IAM role in GCP?

Primitive roles are the legacy Owner / Editor / Viewer roles. They are broad and rarely the right choice. Predefined roles are Google-managed roles scoped to a specific service (e.g., roles/storage.objectViewer). Custom roles are roles you define yourself with a specific permission set. Google’s recommendation: use predefined roles when one fits; create a custom role when none fits; avoid primitive roles for production.

What is a service account in GCP?

A service account is an identity used by an application or workload (rather than a human user). Service accounts have email addresses, can be granted IAM roles, and can be attached to compute resources like VMs, GKE pods, or Cloud Run services. They are how non-human code authenticates to GCP APIs.

What is Workload Identity?

Workload Identity is the recommended way for GKE workloads to authenticate to GCP APIs. It binds a Kubernetes service account to a Google service account so pods receive short-lived tokens automatically, with no JSON keys involved. It is one of the most-tested Domain 5 topics on the Google ACE exam.

How does IAM policy inheritance work in GCP?

IAM policies are inherited downward through the resource hierarchy: Organization → Folder → Project → Resource. A role granted at the organization level applies to every folder, project, and resource beneath. Bindings union together — you cannot subtract a permission at a lower level. Less-permissive policies do not override more-permissive parent policies.

When should I use service account impersonation?

Use service account impersonation when a user (or another service account) needs temporary short-lived access as a different identity, without downloading long-lived JSON keys. Common pattern: developers run gcloud commands as themselves but impersonate a deploy service account for production operations.

What is the principle of least privilege in GCP IAM?

Grant each principal only the permissions they need, scoped to the smallest resource they need it on, for the shortest time they need it. Practically: use predefined or custom roles instead of primitive roles, bind roles at the resource or project level rather than organization level, and use service account impersonation or short-lived tokens for elevated operations rather than persistent admin grants.

What does roles/iam.serviceAccountUser do?

roles/iam.serviceAccountUser lets a principal "act as" a service account — attach it to a VM, Cloud Run service, or Cloud Function, or impersonate it for gcloud commands. It does not grant any permissions the service account itself has; it only grants the right to use that identity. Bound on the service account resource, not on the project.

What does roles/iam.serviceAccountAdmin do?

roles/iam.serviceAccountAdmin lets a principal manage a service account's lifecycle — create, delete, disable, and rotate keys for it — but does not let them act as the service account. That is the key distinction from roles/iam.serviceAccountUser: admin manages the identity, user acts as the identity.

What does roles/iam.workloadIdentityUser do?

roles/iam.workloadIdentityUser is the binding that connects a Kubernetes service account (KSA) to a Google service account (GSA) under Workload Identity. Granting a KSA this role on a GSA lets pods running as that KSA obtain short-lived tokens for the GSA, with no JSON keys involved.

What does roles/iam.serviceAccountTokenCreator do?

roles/iam.serviceAccountTokenCreator lets a principal generate short-lived access tokens for a target service account — the permission behind service account impersonation. A developer with this role on a deploy service account can run gcloud commands as that service account without ever downloading a JSON key.

What is the difference between an IAM binding and an IAM member?

A member (or principal) is the "who" — a user, group, or service account. A binding pairs a role with one or more members on a resource ("these members have this role here"). An IAM policy is the full collection of bindings attached to a resource. "Member" and "binding" are often used loosely in conversation, but a binding is the role-to-member pairing; a member is just one entry inside it.

What does the iam.serviceAccounts.actAs permission do?

iam.serviceAccounts.actAs is the individual permission (bundled inside roles like roles/iam.serviceAccountUser) that lets a principal attach or impersonate a specific service account. It is the permission GCP checks whenever you try to deploy a resource "as" a service account — for example, launching a Compute Engine VM with a given service account attached.

What does a service account email ending in iam.gserviceaccount.com mean?

Every user-managed service account gets an auto-generated email of the form SA_NAME@PROJECT_ID.iam.gserviceaccount.com. This is the identity string you reference in IAM bindings, gcloud --impersonate-service-account flags, and Workload Identity annotations. Google-managed service accounts (created automatically for certain APIs) use different, reserved email patterns instead.

What are the best practices for GCP service accounts?

Avoid keys in favor of attached service accounts, Workload Identity, Workload Identity Federation and impersonation; use one service account per workload; avoid default service accounts and basic roles; grant the narrowest role on the narrowest resource; restrict who can act as or impersonate each account; and disable unused accounts before deleting them.

What is the difference between roles/iam.serviceAccountUser and roles/iam.serviceAccountTokenCreator?

serviceAccountUser lets a principal attach a service account to a resource so the resource runs as that identity (the actAs permission). serviceAccountTokenCreator lets a principal mint short-lived credentials for the service account, which is what impersonation uses. Use User for deploying resources and TokenCreator for running commands as the account.

What is the difference between Workload Identity and Workload Identity Federation?

Workload Identity connects Kubernetes service accounts in GKE to Google service accounts. Workload Identity Federation lets workloads outside Google Cloud, such as AWS, Azure or GitHub Actions, exchange an external identity token for short-lived Google credentials. Both avoid long-lived JSON keys.

Sources and further reading

Practise IAM scenarios

Domain 5 (Access and security) is 20% of the ACE exam and the most-failed domain after Domain 3. Drill it with realistic practice questions. 30 free questions, no signup.