GCP IAM Permission-Denied (403) Debug Prompt
Decode a specific GCP PERMISSION_DENIED / 403 error by tracing the exact missing permission back through the resource hierarchy, the calling principal, conditions, and deny policies — instead of guessing roles or granting Owner.
- Target user
- Cloud and platform engineers debugging GCP access errors
- Difficulty
- Intermediate
- Tools
- Claude, ChatGPT, Cursor
The prompt
You are a senior GCP IAM engineer who debugs PERMISSION_DENIED errors by reasoning from the policy, not by guessing roles. I will provide: - The full error message (the `PERMISSION_DENIED` body, the permission string like `compute.instances.start`, the resource name, and the failing principal) - The calling identity: user, service account, or attached SA, plus how it authenticated (`gcloud auth list`, workload identity, key) - Relevant policy output: `gcloud projects get-iam-policy`, folder/org policy if available, and any IAM Conditions - Whether deny policies, VPC Service Controls, or org policy constraints might be in play Your job: 1. **Pin the exact permission** — map the failing permission string to the roles that contain it (`gcloud iam roles describe` / predefined-role lookup), so I know exactly what to grant. 2. **Confirm the real principal** — identify which identity actually made the call (active credential vs attached SA vs impersonation chain), since the error often blames the wrong actor. 3. **Walk the hierarchy** — check where the binding should live (resource → project → folder → org) and whether inheritance should already cover it. 4. **Check the blockers** — evaluate IAM Conditions (expiry, resource tags, IP), explicit deny policies, and VPC-SC perimeters that can override an allow. 5. **Recommend the minimal fix** — the smallest predefined or custom role (or condition tweak) that resolves it, with the exact `gcloud ... add-iam-policy-binding` command. 6. **Verify** — show how to confirm with `gcloud ... test-iam-permissions` or Policy Troubleshooter before and after. Output as: (a) root cause in one sentence, (b) principal + permission + resource table, (c) exact minimal grant command, (d) verification steps. Never suggest Owner/Editor as a fix.
Run this prompt with AI
Test it, get an AI-improved version, or compare models — live in the Prompt Workspace. No copy-paste.
Related prompts
-
GCP IAM Least-Privilege Binding Review Prompt
Audit IAM bindings across a project or folder to strip over-broad primitive roles, scope service accounts, and add IAM Conditions — without breaking the workloads that actually need access.
-
GCP Terraform Review: IaC Security & Drift Prompt
Review Terraform for GCP before apply — catch over-broad IAM bindings, public buckets, open firewall rules, unpinned providers, and dangerous plan changes that would replace stateful resources.
-
GCP Shared VPC Host & Service Project Design Prompt
Design a Shared VPC topology — host project, service projects, subnet sharing, and IAM — that centralizes networking without blocking teams, so GKE and Compute workloads land in the right subnets with least-privilege access.
-
GCP Cloud NAT & Egress Connectivity Debug Prompt
Debug failed outbound connectivity from private GCP instances — Cloud NAT port exhaustion, dropped egress, Private Google Access gaps, and route/firewall blocks — by reasoning from NAT metrics and config instead of assigning public IPs.
More GCP with AI prompts & error guides
Browse every GCP with AI prompt and troubleshooting guide in one place.
Reading prompts? Get all 500 in one free PDF
500 battle-tested, copy-paste AI prompts engineered by a senior systems engineer — every one with fill-in placeholders and safety/back-out notes. Drop your email and it's yours.
- 500 prompts: Linux · Kubernetes · Terraform · OpenStack · GitLab · Docker · Monitoring · Incident Response
- Instant PDF download — yours free, forever
- Plus one practical AI-workflow email a week (no spam)
Single opt-in · unsubscribe anytime · no spam.