GCP Projects and Organization
The resource hierarchy and billing boundary
GCP is organized as an org → folder → project tree. IAM binds roles to members at any level, billing rolls up per project, and folders/org policies set guardrails.
What you will learn
- Structure org → folders → projects
- Apply IAM boolean/role bindings at the right node
- Use folders and org policies for governance
Google Cloud resources nest: Organization → Folders → Projects → Resources. IAM roles bind at any level and inherit down; billing is per-project; Organization policies constrain creation/usage.
What is this?
The GCP resource hierarchy starts at the Organization (the root of all resources, tied to a Cloud Identity/Workspace domain). Folders group projects into teams/environments for policy and IAM aggregation. Projects are the core container: every API-enabled resource lives in a project, which owns quota and billing. IAM binds roles to principals (users, groups, service accounts) at org/folder/project/resource scopes; permissions inherit down unless overridden. Organization/Project policies (constraints like 'restrict VM external IPs') enforce guardrails.
Why do you need it?
- Project isolation is the blast-radius unit: prod vs dev projects keep leakage small.
- Folder-level IAM lets a security team read everything without touching each project.
- Billing attribution is per project — cost centers map directly to projects.
- Org policies stop 'oops, I made a public bucket' before it happens.
Mental model
A company HQ with floors, teams and desks
Org, folders, projects, resources
HQ (org) sets company policy; floors (folders) organize teams; each team's rooms (projects) hold their desks (resources). Security badges issued at HQ carry into every room; floor guards enforce extra rules.
How it works
- Organization root grants the initial Organization Admin; folders nest beneath.
- Projects get unique project IDs/names/numbers; billing account(s) attach at project or folder level.
- IAM allows/denies at scopes: org → folder → project → resource; child can't grant what parent denies.
- ServicAccounts are machine identities; keys are restricted best-practice (prefer workload identity).
- Org policies are constraints enforced during resource creation/use (e.g. deny public buckets, restrict regions).
GCP resource hierarchy.
Examples
Inspect hierarchy and apply a role
# List projects you can seegcloud projects list --format=table(projectId,name) # Set a folder-scoped viewer role (folder 12345)gcloud projects add-iam-policy-binding <project-id> \ --member group:platform@example.com --role roles/viewer # Check org policy constraints in a projectgcloud resource-manager org-policies list --project <project-id>CLI trails show where you are in the tree — project list, IAM bindings, and constraints reveal governance in one sweep.
In production
- A platform org uses one folder per environment, a shared infra folder, and a security folder with a log sink.
- A startup pins each product to its own project with per-product billing and a shared network project.
- A bank applies an org policy banning external IPs on VMs inside the prod folder.
Best practices
- Give each environment/team a project; avoid one-and-done 'everything' projects early.
- Bind IAM at the highest node that is safe (e.g. Viewer at org, Editor at project).
- Use folder-level org policies and validate in audit mode before enforcing.
- Restrict service account keys; prefer workload identity federation in CI.
Common mistakes
- Granting Owner at org level to whoever builds the first project.
- Creating 200 projects with no folder structure or naming convention.
- Putting prod and dev in one project to 'simplify' billing.
- Enabling a deny org policy before a rollout plan — breakage and pushback.
Common issues
Cannot create resource in an allowed regionOrg policy restrictRegions constraint excludes it
Check restrictRegions at org/folder/project and request an exception or use an allowed region.
CI can't access a bucketService account lacks storage.objectViewer on the bucket/project
Grant the role at the correct scope or use the project-level default compute SA carefully.
Billing shows unknown spendAnother project uses the same billing account, or missing labels
Review per-project cost reports and apply budget alerts per project.
Debugging tips
- Permission denied at project but granted at folder → check folder binding and inherited role.
- Quota errors: verify the project's quota and the region's capacity separately.
- Org policy blocking a deploy → look at constraint violations in the Cloud Logging audit trail.
- Use `gcloud projects get-iam-policy` and `--format=json` to diff policy drift.
Interview checkpoint
Hands-on lab
- List projects and inspect their metadata
- Create a budget alert for a project
- Verify IAM bindings at folder/project scope
Walk the Project Hierarchy and a Budget
25 min · beginner
Quick quiz
What is the smallest container that holds GCP resources and owns quota/billing?
An organization policy can forbid the creation of publicly-exposed buckets.