3. Projects¶
Projects are the core organizational unit in GCP where all resources are created and billed.
Overview¶
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Project Characteristics β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β β
β Project ID: web-prod-2026 (immutable, unique) β
β Project Number: 123456789012 (auto-assigned) β
β Project Name: Web Production (mutable, display) β
β β
β Purpose: β
β β’ Resource container (VMs, DBs, buckets, etc.) β
β β’ Billing boundary (separate billing per project) β
β β’ API enablement (enable services per project) β
β β’ Quota management (resource limits per project) β
β β’ IAM boundary (access control isolation) β
β β’ Audit logging scope β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Project Identifiers¶
Three Types of Identifiers¶
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Project Identifiers Comparison β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β β
β Project ID β
β β’ User-defined (must be globally unique) β
β β’ Immutable (cannot be changed) β
β β’ 6-30 characters, lowercase, numbers, hyphens β
β β’ Example: web-prod-2026 β
β β’ Used in: gcloud commands, APIs, URLs β
β β
β Project Number β
β β’ Auto-assigned by Google β
β β’ Immutable (permanent identifier) β
β β’ Numeric only β
β β’ Example: 123456789012 β
β β’ Used in: Service accounts, some APIs β
β β
β Project Name β
β β’ User-defined (display name) β
β β’ Mutable (can be changed anytime) β
β β’ Not unique (multiple projects can have same name) β
β β’ Example: Web Production β
β β’ Used in: Console UI, reports β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Project Lifecycle¶
Creation¶
# Create project (auto-assigned to user)
gcloud projects create web-prod-2026 \
--name="Web Production"
# Create project in folder
gcloud projects create web-prod-2026 \
--name="Web Production" \
--folder=FOLDER_ID
# Create project in organization
gcloud projects create web-prod-2026 \
--name="Web Production" \
--organization=ORGANIZATION_ID
# Create with labels
gcloud projects create web-prod-2026 \
--name="Web Production" \
--labels=environment=production,team=web,cost-center=engineering
# Link billing account
gcloud billing projects link web-prod-2026 \
--billing-account=BILLING_ACCOUNT_ID
Management¶
# List projects
gcloud projects list
# List with filter
gcloud projects list --filter="projectId:web-*"
# Describe project
gcloud projects describe web-prod-2026
# Update project name
gcloud projects update web-prod-2026 \
--name="Web Production Updated"
# Add labels
gcloud projects update web-prod-2026 \
--update-labels=version=v2,owner=alice
# Remove labels
gcloud projects update web-prod-2026 \
--remove-labels=version
Deletion and Recovery¶
# Delete project (soft delete, 30-day recovery period)
gcloud projects delete web-prod-2026
# Undelete project (within 30 days)
gcloud projects undelete web-prod-2026
# Check project lifecycle state
gcloud projects describe web-prod-2026 \
--format="value(lifecycleState)"
# States: ACTIVE, DELETE_REQUESTED, DELETE_IN_PROGRESS
Project Structure¶
Typical Project Contents¶
Project: web-prod-2026
β
βββ Compute Resources
β βββ Compute Engine VMs (10 instances)
β βββ GKE Cluster (3-node cluster)
β βββ Cloud Run Services (5 services)
β βββ App Engine Application
β
βββ Storage
β βββ Cloud Storage Buckets (15 buckets)
β βββ Persistent Disks (20 disks)
β βββ Filestore Instances (2 instances)
β
βββ Databases
β βββ Cloud SQL (2 instances)
β βββ Firestore (1 database)
β βββ Memorystore Redis (1 instance)
β
βββ Networking
β βββ VPC Networks (2 networks)
β βββ Subnets (5 subnets)
β βββ Firewall Rules (20 rules)
β βββ Load Balancers (3 LBs)
β βββ Cloud NAT (1 gateway)
β
βββ Security & IAM
β βββ Service Accounts (10 accounts)
β βββ IAM Policies
β βββ Secrets (Secret Manager)
β βββ Encryption Keys (Cloud KMS)
β
βββ APIs & Services
β βββ Enabled APIs (50 APIs)
β βββ API Keys
β βββ OAuth Credentials
β
βββ Monitoring & Logging
βββ Cloud Monitoring Dashboards
βββ Alerting Policies
βββ Log Sinks
βββ Uptime Checks
Project Naming Conventions¶
Recommended Patterns¶
Pattern: <service>-<environment>-<region>-<purpose>
Examples:
β web-prod-us-frontend
β api-prod-eu-backend
β data-prod-global-warehouse
β ml-dev-us-training
β network-shared-global-hub
β monitoring-shared-global-central
Pattern: <team>-<app>-<environment>
Examples:
β backend-ecommerce-prod
β frontend-mobile-staging
β data-analytics-dev
β devops-cicd-prod
Pattern: <company>-<bu>-<env>-<app>
Examples:
β acme-retail-prod-web
β acme-analytics-prod-dwh
β acme-mobile-dev-ios
Naming Rules¶
β Use lowercase letters
β Use hyphens for separation
β Include environment (prod/staging/dev)
β Be descriptive but concise
β 6-30 characters
β Start with letter
β End with letter or number
β Globally unique
β Avoid underscores
β Avoid special characters
β Avoid generic names (project1, test)
β Avoid PII or sensitive info
Project Quotas and Limits¶
Common Quotas¶
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Default Project Quotas β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β β
β Compute Engine: β
β β’ CPUs: 24 per region β
β β’ Persistent Disk: 10 TB per region β
β β’ In-use IP addresses: 8 per region β
β β’ VMs: Varies by machine type β
β β
β Cloud Storage: β
β β’ Buckets: 10,000 per project β
β β’ Objects: Unlimited β
β β’ Bandwidth: 200 Gbps egress β
β β
β Cloud SQL: β
β β’ Instances: 100 per project β
β β’ Storage: 30 TB per instance β
β β’ Connections: Varies by tier β
β β
β GKE: β
β β’ Clusters: 50 per project per region β
β β’ Nodes: 5,000 per cluster β
β β’ Pods: 110 per node (default) β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Managing Quotas¶
# View quotas
gcloud compute project-info describe \
--project=web-prod-2026
# Request quota increase
# (Must be done through Console: IAM & Admin β Quotas)
# Check specific quota
gcloud compute regions describe us-central1 \
--project=web-prod-2026 \
--format="table(quotas.metric,quotas.limit,quotas.usage)"
Project IAM¶
Project-Level Roles¶
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Common Project Roles β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β β
β Owner (roles/owner) β
β β’ Full control over project β
β β’ Manage IAM policies β
β β’ Delete project β
β β’ Manage billing β
β β
β Editor (roles/editor) β
β β’ Create/modify/delete resources β
β β’ Cannot manage IAM β
β β’ Cannot delete project β
β β
β Viewer (roles/viewer) β
β β’ Read-only access β
β β’ View resources and configurations β
β β’ Cannot make changes β
β β
β Browser (roles/browser) β
β β’ Browse project hierarchy β
β β’ View project in console β
β β’ Minimal permissions β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
IAM Management¶
# Grant project role
gcloud projects add-iam-policy-binding web-prod-2026 \
--member='user:alice@company.com' \
--role='roles/editor'
# Grant to group
gcloud projects add-iam-policy-binding web-prod-2026 \
--member='group:developers@company.com' \
--role='roles/viewer'
# Grant to service account
gcloud projects add-iam-policy-binding web-prod-2026 \
--member='serviceAccount:app@web-prod-2026.iam.gserviceaccount.com' \
--role='roles/storage.objectViewer'
# Remove role
gcloud projects remove-iam-policy-binding web-prod-2026 \
--member='user:bob@company.com' \
--role='roles/editor'
# Get IAM policy
gcloud projects get-iam-policy web-prod-2026
# Set IAM policy from file
gcloud projects set-iam-policy web-prod-2026 policy.yaml
API Management¶
Enabling APIs¶
# List enabled APIs
gcloud services list --enabled \
--project=web-prod-2026
# List available APIs
gcloud services list --available \
--project=web-prod-2026
# Enable API
gcloud services enable compute.googleapis.com \
--project=web-prod-2026
# Enable multiple APIs
gcloud services enable \
compute.googleapis.com \
storage.googleapis.com \
sqladmin.googleapis.com \
container.googleapis.com \
--project=web-prod-2026
# Disable API
gcloud services disable compute.googleapis.com \
--project=web-prod-2026
# Check if API is enabled
gcloud services list --enabled \
--filter="name:compute.googleapis.com" \
--project=web-prod-2026
Project Migration¶
Moving Projects¶
# Move project to folder
gcloud projects move web-prod-2026 \
--folder=FOLDER_ID
# Move project to organization root
gcloud projects move web-prod-2026 \
--organization=ORGANIZATION_ID
# Verify move
gcloud projects describe web-prod-2026 \
--format="value(parent)"
Migration Checklist¶
Before Migration:
β Backup IAM policies
β Document current structure
β Review destination policies
β Check billing account
β Test with non-critical project
β Communicate with team
After Migration:
β Verify access works
β Check inherited policies
β Test applications
β Update documentation
β Monitor for issues
Billing¶
Billing Account Linkage¶
# List billing accounts
gcloud billing accounts list
# Link billing account to project
gcloud billing projects link web-prod-2026 \
--billing-account=BILLING_ACCOUNT_ID
# Check billing status
gcloud billing projects describe web-prod-2026
# Unlink billing (disables billable resources)
gcloud billing projects unlink web-prod-2026
Cost Management¶
# Set budget
gcloud billing budgets create \
--billing-account=BILLING_ACCOUNT_ID \
--display-name="Web Prod Budget" \
--budget-amount=5000 \
--threshold-rule=percent=50 \
--threshold-rule=percent=90 \
--threshold-rule=percent=100 \
--filter-projects=projects/web-prod-2026
# Export billing to BigQuery
# (Configure in Console: Billing β Billing export)
Terraform Example¶
# Create project
resource "google_project" "web_prod" {
name = "Web Production"
project_id = "web-prod-2026"
folder_id = var.folder_id
billing_account = var.billing_account_id
labels = {
environment = "production"
team = "web"
cost_center = "engineering"
}
}
# Enable APIs
resource "google_project_service" "apis" {
for_each = toset([
"compute.googleapis.com",
"storage.googleapis.com",
"sqladmin.googleapis.com",
"container.googleapis.com",
])
project = google_project.web_prod.project_id
service = each.key
disable_on_destroy = false
}
# Grant IAM roles
resource "google_project_iam_member" "editors" {
project = google_project.web_prod.project_id
role = "roles/editor"
member = "group:web-team@company.com"
}
# Create service account
resource "google_service_account" "app" {
project = google_project.web_prod.project_id
account_id = "web-app"
display_name = "Web Application Service Account"
}
Best Practices¶
β Use descriptive, consistent naming
β Link billing account immediately
β Enable required APIs upfront
β Apply labels for cost tracking
β Implement least privilege IAM
β Enable audit logging
β Set up budgets and alerts
β Document project purpose
β Regular access reviews
β Use service accounts for apps
Next Steps¶
- Resource Manager β 4-Resource-Manager.md
- Organization Policies β 5-Organization-Policies.md
- Tags & Labels β 7-Tags-Labels.md