More Info:
Determines if the number of resources is close to the per-account limit. Google limits accounts to certain numbers of resources. Exceeding those limits could prevent resources from launching.Risk Level
LowAddress
Operational MaturityCompliance Standards
Triage and Remediation
- Remediation
Remediation
Using Console
Using Console
Here’s how to remediate GCP IAM “Service Limits” (quota) issues using the GCP Console, focusing on IAM-related quotas (service accounts, roles, policy bindings, etc.).
1. Identify Which IAM Limit You’re Hitting
- Go to IAM & Admin → Quotas in the GCP Console
- URL:
https://console.cloud.google.com/iam-admin/quotas
- URL:
- In the Services filter, select:
- IAM Service Account Credentials API, Identity and Access Management (IAM) API, and/or Cloud Resource Manager API, depending on what you’re working with.
- Use the Metric filter to locate relevant quotas, for example:
- Service accounts per project
- Custom roles per organization/project
- Policy size / policy bindings per resource
- API requests per minute/hour
- Check which quota shows Usage close to or at Limit or is marked as Blocked.
2. Short-Term Remediation: Reduce Usage (Clean Up IAM Resources)
Depending on which limit is impacted:A. If you hit service account limits
- Go to IAM & Admin → Service Accounts
https://console.cloud.google.com/iam-admin/serviceaccounts
- Sort or filter by Last used (if available) or by Name/Description to identify unused accounts.
- For each unused service account:
- Click the three dots (⋮) → Delete.
- If apps can share accounts:
- Consolidate multiple similar service accounts into fewer, well-scoped service accounts.
- Update workloads (GCE, GKE, Cloud Run, etc.) to use shared accounts with least-privilege roles.
B. If you hit custom role limits
- Go to IAM & Admin → Roles
https://console.cloud.google.com/iam-admin/roles
- Filter for Custom roles.
- Identify:
- Roles that are deprecated, not used, or duplicate.
- For unused custom roles:
- Click the role → Delete (or Disable first if you want a safe test).
- Merge overlapping custom roles where possible so fewer custom roles are needed.
C. If you hit policy size / bindings limits
- Go to IAM & Admin → IAM
https://console.cloud.google.com/iam-admin/iam
- Look for:
- Members with many roles, or roles with many members.
- Reduce bindings:
- Replace many individual users with Google Groups and assign roles to the group instead.
- Remove obsolete members or roles that are no longer required.
- Prefer predefined roles instead of several overlapping custom roles.
D. If you hit IAM API request rate limits
- Reduce automation chattiness:
- Batch IAM changes where possible.
- Avoid scripts that repeatedly call
setIamPolicy/getIamPolicyin tight loops.
- Space out calls:
- Implement backoff and retry in tooling, if you control it.
3. Long-Term Remediation: Request a Quota Increase
- Go to IAM & Admin → Quotas
https://console.cloud.google.com/iam-admin/quotas
- Filter by Service and Metric to locate the specific quota you’re exceeding.
- Check the box next to the quota you want to increase.
- At the top, click EDIT QUOTAS.
- In the side panel:
- Select a Support case channel (you may need a support plan).
- Fill in:
- New limit you’re requesting.
- Justification (describe workloads, growth, why cleanup alone isn’t enough).
- Submit the request and monitor the status in your Support section.
4. Validate After Remediation
- Re-run the action that previously failed (e.g., create service account, add IAM binding).
- Revisit IAM & Admin → Quotas to confirm:
- Usage is below limit, or
- New higher limit is applied.
- Optionally, set up internal processes:
- Periodic review of service accounts, roles, and bindings.
- Use Groups and standardized roles to control IAM sprawl.
Using CLI
Using CLI
For IAM on GCP, “Service Limits” (quotas) can’t actually be raised directly via gcloud; increases are requested via the web console or a support case. With the CLI you can:
If the bindings count is near/above 1500, you’re hitting the IAM policy bindings limit.
This lets you see:Delete that block or remove individual members.Repeat the same pattern for:With one group binding:Then remove the per-user bindings as in 2.2.
Repeat at org level with
- Identify what limit you’re hitting
- Reduce usage (cleanup / refactor IAM)
- Then formally request a quota increase in the console
1. Identify which IAM limit you’re hitting
Common IAM limits include:- Max bindings per policy (e.g., 1,500 bindings on a project)
- Max roles per principal
- Max custom roles per project/org
- Permissions per custom role
gcloud projects add-iam-policy-binding, gcloud iam roles create, etc.) and note the exact error text, e.g.:RESOURCE_EXHAUSTEDQuota exceededexceeds the maximum number of bindingsMaximum number of custom roles reached
gcloud command to show IAM policy limits, but you can:2. Remediate by reducing IAM policy size (clean up via CLI)
2.1 List IAM policy bindings
- Roles that are overused or duplicated
- Direct user/service account bindings that can be replaced by groups
2.2 Remove unused or redundant bindings
- Get current policy:
- Edit
policy.json:- Remove bindings you no longer need.
- Consolidate multiple bindings where possible (e.g., same role with multiple members → one binding with combined members).
policy.json):- Set the updated policy:
gcloud organizations get-iam-policy/set-iam-policygcloud folders get-iam-policy/set-iam-policy
2.3 Replace individual bindings with group-based bindings
- Create or use an existing Google Group in your org (done in Admin Console, not gcloud).
- Replace many individual user bindings with a single group binding.
2.4 Use custom roles to reduce per-binding permission sprawl
If you’re hitting “permissions per custom role” or similar:- Inspect a custom role:
- Reduce permissions if there are many rarely-used ones:
- If you have many near-identical custom roles, consolidate them into fewer roles with shared permissions.
3. Remediate “too many custom roles” limit
If error mentions maximum custom roles per project/org:- List all custom roles:
- Identify unused ones (for example, by last used in your own CMDB / internal docs; GCP doesn’t give per-role usage counts directly via gcloud).
- Disable roles you no longer need:
- After validation, delete them:
--organization=ORG_ID.4. Request a quota increase (cannot be done via gcloud)
Once you’ve optimized, if you still hit limits you must request a quota increase:-
Go to:
https://console.cloud.google.com/iam-admin/quotas -
Filter for:
- “IAM”
- Or the specific quota mentioned in your error (e.g., “Policy size”, “Custom roles per project”).
-
Select the quota → “EDIT QUOTAS” → fill out:
- Project
- Contact details
- New requested limit
- Justification
- Submit and wait for approval.
Summary (CLI-only actions)
- Use
gcloud projects/organizations/folders get-iam-policyto inspect policy size and bindings. - Clean up and consolidate IAM bindings by editing JSON and applying via
set-iam-policy. - Use group-based IAM instead of many per-user bindings.
- Consolidate and clean up custom roles via
gcloud iam roles list/update/delete. - Any actual increase in the service limit must be requested via the GCP Console or support, not gcloud.
Using Python
Using Python
“Service limits” for GCP IAM usually means you’re hitting or about to hit hard limits like:
Make sure your ADC (Application Default Credentials) has permission:
This doesn’t fix anything yet; it just tells you where you’re likely to hit service limits.
You can extend this logic to:
You would typically configure alerts in the console, but you can automate that with the Monitoring API if desired.
If you can share:
- Max role bindings per policy (e.g., 1,500 bindings)
- Max members per binding
- API rate limits / quotas for
iam.googleapis.com
- detecting when you’re close to limits
- cleaning up unused / duplicate IAM bindings
- batching / optimizing calls to stay under API quota
1. Set up Python environment
roles/resourcemanager.projectIamAdminfor modifying project IAMroles/monitoring.viewer(optional for monitoring quotas)
2. Detect IAM policy “bloat” (bindings/members near limits)
Example: check all IAM bindings on a project and warn if near a threshold.3. Remediate by cleaning up IAM bindings
Typical cleanups:- Remove members that no longer exist (users, service accounts)
- Remove duplicate members
- Remove roles that are no longer needed
- remove specific members from specific roles
- then write back the cleaned policy
- drop bindings where the role is no longer used in your org
- move many individual users to a Google group and grant the role to the group instead (reduces members per binding)
4. Avoid IAM API quota limits (rate limits)
If your scanner / automation is hitting IAM rate limits, you need to:- Batch operations when possible
- Use exponential backoff on
429/503responses
5. Monitor IAM quotas via Cloud Monitoring (optional)
You can track metrics likeiam.googleapis.com/quota/allocation/usage and alert when near quota.Basic example to list IAM quota metrics:6. When you truly hit a hard service limit
- If you hit hard IAM structural limits (e.g., max bindings per policy):
- Consolidate: use groups instead of many individual members
- Split: move resources into additional projects / folders so policy is distributed
- If you hit quota limits (API calls, QPS):
- Optimize code (batch, cache, backoff)
- Then request a quota increase in the console (IAM & Admin → Quotas), which cannot be done purely via Python.
If you can share:
- which exact IAM service limit you’re hitting (bindings, members, API QPS, etc.) I can give you a more targeted Python snippet tailored to that specific limit.
Using Terraform
Using Terraform
gcloud services quotas where available. terraform plan cannot show a quota change because it is outside Terraform’s control.
