π’ Resource Hierarchy¶
Google Cloud uses a hierarchical structure to organize and manage resources, providing centralized control over access, billing, and policies.
Hierarchy Overview¶
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Resource Hierarchy β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
ββββββββββββββββββββ
β Organization β β Root node (company.com)
β (Root Node) β
ββββββββββ¬ββββββββββ
β
ββββββββββββββββΌβββββββββββββββ
β β β
βββββββΌββββββ ββββββΌβββββ βββββββΌββββββ
β Folder β β Folder β β Folder β β Departments/Teams
β (Prod) β β (Dev) β β (Shared) β
βββββββ¬ββββββ ββββββ¬βββββ βββββββ¬ββββββ
β β β
βββββββΌββββββ βββββΌβββββ ββββββΌββββββ
β Project β βProject β β Project β β Billing & isolation
β (App-1) β β(App-2) β β(Network) β
βββββββ¬ββββββ βββββ¬βββββ ββββββ¬ββββββ
β β β
βββββββΌββββββ ββββΌββββββ βββββΌβββββββ
β Resources β βResourcesβ βResources β β VMs, DBs, etc.
β β’ VM β ββ’ Cloud β ββ’ VPC β
β β’ DB β β Run β ββ’ Firewallβ
β β’ Bucket β ββ’ Storageβ ββ’ Routes β
βββββββββββββ βββββββββββ ββββββββββββ
1. Organization Node¶
The Organization is the root node representing your company or domain.
Key Characteristics¶
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Organization: company.com β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β β
β Purpose: β
β β’ Top-level container for all GCP resources β
β β’ Centralized policy management β
β β’ Organization-wide IAM roles β
β β’ Consolidated billing β
β β
β Created when: β
β β’ Google Workspace account exists β
β β’ Cloud Identity account is set up β
β β
β Organization Admin: β
β β’ Full control over all resources β
β β’ Can grant/revoke access β
β β’ Manages organization policies β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Organization Roles¶
| Role | Permissions | Use Case |
|---|---|---|
Organization Admin |
Full control over organization | IT administrators |
Organization Viewer |
Read-only access to organization | Auditors, compliance |
Folder Admin |
Manage folders and projects | Department leads |
Project Creator |
Create new projects | Development teams |
Setup Organization¶
# Check if organization exists
gcloud organizations list
# Get organization ID
gcloud organizations describe ORGANIZATION_ID
# Grant organization admin role
gcloud organizations add-iam-policy-binding ORGANIZATION_ID \
--member='user:admin@company.com' \
--role='roles/resourcemanager.organizationAdmin'
2. Folders¶
Folders provide a grouping mechanism for projects, enabling hierarchical organization and policy inheritance.
Folder Structure Patterns¶
Pattern 1: Environment-Based¶
Organization (company.com)
β
βββ Production Folder
β βββ ecommerce-prod
β βββ analytics-prod
β βββ api-gateway-prod
β
βββ Staging Folder
β βββ ecommerce-staging
β βββ analytics-staging
β
βββ Development Folder
β βββ ecommerce-dev
β βββ analytics-dev
β
βββ Sandbox Folder
βββ experimental-projects
Pattern 2: Department-Based¶
Organization (company.com)
β
βββ Engineering Folder
β βββ Backend Team
β β βββ api-services-prod
β β βββ api-services-dev
β βββ Frontend Team
β βββ web-app-prod
β βββ web-app-dev
β
βββ Data Science Folder
β βββ ml-models-prod
β βββ data-pipelines
β
βββ Security Folder
β βββ security-monitoring
β βββ compliance-logs
β
βββ Shared Services Folder
βββ networking-hub
βββ monitoring-central
Pattern 3: Business Unit-Based¶
Organization (company.com)
β
βββ E-commerce BU
β βββ Production
β β βββ web-frontend
β β βββ payment-service
β β βββ inventory-service
β βββ Development
β βββ dev-projects
β
βββ Analytics BU
β βββ Data Warehouse
β βββ BI Tools
β
βββ Infrastructure BU
βββ Networking
βββ Security
Folder Benefits¶
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Why Use Folders? β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β β
β 1. POLICY INHERITANCE β
β βββ Policies applied at folder level cascade β
β down to all projects within β
β β
β 2. ACCESS CONTROL β
β βββ Grant IAM roles at folder level for β
β multiple projects at once β
β β
β 3. ORGANIZATION β
β βββ Logical grouping by environment, team, β
β or business unit β
β β
β 4. BILLING SEPARATION β
β βββ Track costs by folder/department β
β β
β 5. COMPLIANCE β
β βββ Enforce security policies per environment β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Folder Management¶
# Create folder
gcloud resource-manager folders create \
--display-name="Production" \
--organization=ORGANIZATION_ID
# List folders
gcloud resource-manager folders list \
--organization=ORGANIZATION_ID
# Move project to folder
gcloud projects move PROJECT_ID \
--folder=FOLDER_ID
# Set IAM policy on folder
gcloud resource-manager folders add-iam-policy-binding FOLDER_ID \
--member='group:engineering@company.com' \
--role='roles/editor'
3. Projects¶
Projects are the core organizational unit in GCP. All resources must belong to a project.
Project Characteristics¶
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Project: ecommerce-prod-2026 β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β β
β Project ID: ecommerce-prod-2026 β
β Project Number: 123456789012 β
β Project Name: E-commerce Production β
β β
β Purpose: β
β β’ Billing boundary (separate billing account) β
β β’ Resource namespace (unique resource names) β
β β’ IAM boundary (access control isolation) β
β β’ API enablement (enable services per project) β
β β’ Quota management (resource limits per project) β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Project Naming Conventions¶
Pattern: <service>-<environment>-<region>-<purpose>
Examples:
β ecommerce-prod-us-web
β analytics-dev-eu-pipeline
β payment-staging-asia-api
β shared-prod-global-network
β ml-training-dev-us-gpu
Best Practices:
β’ Use lowercase and hyphens
β’ Include environment (prod/staging/dev)
β’ Keep it descriptive but concise
β’ Project ID is immutable (choose carefully)
Project Structure Example¶
Project: ecommerce-prod-us
βββ Compute Resources
β βββ GKE Cluster (web-cluster)
β βββ Compute Engine VMs (batch-processors)
β βββ Cloud Run Services (api-gateway)
β
βββ Storage Resources
β βββ Cloud Storage Buckets (product-images)
β βββ Persistent Disks (database-volumes)
β βββ Filestore (shared-files)
β
βββ Database Resources
β βββ Cloud SQL (postgres-primary)
β βββ Cloud Spanner (global-inventory)
β βββ Firestore (user-sessions)
β
βββ Networking Resources
β βββ VPC Network (prod-vpc)
β βββ Subnets (web-subnet, db-subnet)
β βββ Firewall Rules (allow-http, allow-ssh)
β βββ Load Balancers (global-lb)
β
βββ Security & Monitoring
βββ IAM Policies
βββ Service Accounts
βββ Cloud Monitoring
βββ Cloud Logging
Project Management¶
# Create project
gcloud projects create ecommerce-prod-2026 \
--name="E-commerce Production" \
--folder=FOLDER_ID
# List projects
gcloud projects list
# Set active project
gcloud config set project ecommerce-prod-2026
# Enable APIs
gcloud services enable compute.googleapis.com
gcloud services enable container.googleapis.com
gcloud services enable sqladmin.googleapis.com
# Get project details
gcloud projects describe ecommerce-prod-2026
# Delete project (soft delete, 30-day recovery)
gcloud projects delete ecommerce-prod-2026
4. Resources¶
Resources are the actual GCP services and components that run within projects.
Resource Categories¶
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Resource Types in GCP β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β β
β COMPUTE β
β β’ Compute Engine VMs β
β β’ GKE Clusters & Nodes β
β β’ Cloud Run Services β
β β’ App Engine Applications β
β β’ Cloud Functions β
β β
β STORAGE β
β β’ Cloud Storage Buckets β
β β’ Persistent Disks β
β β’ Filestore Instances β
β β
β DATABASES β
β β’ Cloud SQL Instances β
β β’ Cloud Spanner Databases β
β β’ Firestore Databases β
β β’ Bigtable Instances β
β β
β NETWORKING β
β β’ VPC Networks β
β β’ Subnets β
β β’ Firewall Rules β
β β’ Load Balancers β
β β’ Cloud NAT β
β β
β SECURITY β
β β’ Service Accounts β
β β’ IAM Policies β
β β’ Secrets (Secret Manager) β
β β’ Encryption Keys (Cloud KMS) β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Resource Scope¶
| Scope | Description | Examples |
|---|---|---|
| Global | Available across all regions | VPC networks, Global load balancers, IAM |
| Regional | Specific to a region | Cloud SQL, GKE clusters, Regional disks |
| Zonal | Specific to a zone | Compute Engine VMs, Zonal disks, GKE nodes |
Policy Inheritance¶
Policies and IAM permissions flow down the hierarchy.
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Policy Inheritance Flow β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Organization Level
ββ Policy: Require MFA for all users
β βββ Applies to ALL folders and projects
β
Folder Level (Production)
ββ Policy: Restrict VM creation to specific machine types
β βββ Applies to ALL projects in Production folder
β
Project Level (ecommerce-prod)
ββ Policy: Enable VPC Flow Logs
β βββ Applies to ALL resources in this project
β
Resource Level (Compute Engine VM)
ββ Policy: Specific firewall rules
βββ Applies to THIS resource only
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Inheritance Rules β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β β’ Child inherits parent policies β
β β’ Child can add more restrictive policies β
β β’ Child CANNOT override parent policies β
β β’ Policies are cumulative (union of all levels) β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
IAM Inheritance Example¶
Organization: company.com
ββ IAM: alice@company.com β Organization Viewer
β βββ Alice can view ALL resources in organization
β
Folder: Production
ββ IAM: bob@company.com β Folder Editor
β βββ Bob can edit ALL projects in Production folder
β
Project: ecommerce-prod
ββ IAM: charlie@company.com β Project Owner
β βββ Charlie has full control over ecommerce-prod project
β
Resource: VM Instance
ββ IAM: dave@company.com β Compute Instance Admin
βββ Dave can manage THIS specific VM
Effective Permissions:
β’ Alice: View all (inherited from org)
β’ Bob: Edit all in Production (inherited from folder)
β’ Charlie: Full control over ecommerce-prod
β’ Dave: Manage specific VM
Real-World Architecture Example¶
Multi-Environment Setup¶
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Organization: acme-corp.com β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
βββββββββββββββββββββΌββββββββββββββββββββ
β β β
ββββββΌββββββ ββββββΌββββββ ββββββΌββββββ
βProductionβ β Staging β β Dev β
β Folder β β Folder β β Folder β
ββββββ¬ββββββ ββββββ¬ββββββ ββββββ¬ββββββ
β β β
ββββββΌβββββββββββ βββββΌβββββββββ ββββββΌββββββββββ
β web-prod-us β βweb-staging β β web-dev-us β
β β β β β β
β Resources: β βResources: β β Resources: β
β β’ GKE (n1-std)β ββ’ GKE (e2) β β β’ GKE (e2) β
β β’ Cloud SQL β ββ’ Cloud SQL β β β’ Cloud SQL β
β (HA) β β (single) β β (dev) β
β β’ 10 VMs β ββ’ 3 VMs β β β’ 1 VM β
β β β β β β
β Policies: β βPolicies: β β Policies: β
β β’ MFA requiredβ ββ’ MFA req. β β β’ Relaxed β
β β’ Audit logs β ββ’ Audit logsβ β β’ No audit β
β β’ Backup dailyβ ββ’ Backup β β β’ No backup β
βββββββββββββββββ β weekly β ββββββββββββββββ
ββββββββββββββ
IAM Structure:
Production Folder:
β’ SRE Team β Editor
β’ Security Team β Viewer
β’ Developers β No access
Staging Folder:
β’ SRE Team β Owner
β’ Developers β Editor
Dev Folder:
β’ Developers β Owner
β’ Everyone β Viewer
Best Practices¶
1. Hierarchy Design¶
β DO:
β’ Use folders for logical grouping
β’ Separate environments (prod/staging/dev)
β’ Apply policies at highest appropriate level
β’ Use consistent naming conventions
β’ Plan for growth and scalability
β DON'T:
β’ Create flat structure (all projects at org level)
β’ Mix environments in same folder
β’ Grant broad permissions at org level
β’ Use generic project names
β’ Create too many nested folders (keep it simple)
2. Project Organization¶
# Good project structure
company-prod-us-web
company-prod-us-api
company-prod-us-data
company-staging-us-web
company-dev-us-web
# Bad project structure
project1
project2
test-project
my-project
3. IAM Management¶
# Grant access at folder level for multiple projects
gcloud resource-manager folders add-iam-policy-binding FOLDER_ID \
--member='group:developers@company.com' \
--role='roles/editor'
# Use groups instead of individual users
gcloud projects add-iam-policy-binding PROJECT_ID \
--member='group:sre-team@company.com' \
--role='roles/owner'
4. Resource Labeling¶
# Apply labels for cost tracking and organization
gcloud compute instances create web-vm \
--labels=environment=production,team=frontend,cost-center=engineering
Migration Strategy¶
Moving from Flat to Hierarchical Structure¶
Step 1: Current State (Flat)
Organization
βββ project-1
βββ project-2
βββ project-3
βββ project-4
Step 2: Create Folder Structure
Organization
βββ Production Folder (created)
βββ Staging Folder (created)
βββ Development Folder (created)
Step 3: Move Projects
Organization
βββ Production Folder
β βββ project-1 (moved)
β βββ project-2 (moved)
βββ Staging Folder
β βββ project-3 (moved)
βββ Development Folder
βββ project-4 (moved)
Step 4: Apply Policies
Organization
βββ Production Folder
β βββ Policy: Require MFA
β βββ Policy: Enable audit logs
β βββ Projects inherit policies