GCP Project Setup Guide
Setting up a Google Cloud Platform project is the first step in your cloud journey. This guide covers everything from initial project creation to configuration and best practices.
Prerequisites
Before creating a GCP project, ensure you have:
- A Google Account (personal or Google Workspace)
- GCP account with billing enabled
- Appropriate permissions to create projects
Creating a New Project
Using gcloud CLI
# Create a new project
gcloud projects create my-awesome-project \
--name="My Awesome Project" \
--set-as-default
# List all projects
gcloud projects list
# Set default project
gcloud config set project my-awesome-project
Using Google Cloud Console
- Navigate to Google Cloud Console
- Click on the project dropdown in the top navigation
- Click “New Project”
- Enter project name and organization (if applicable)
- Click “Create”
Project Configuration
Enable Billing
Billing is required for most GCP services:
# Link a billing account to your project
gcloud beta billing projects link my-awesome-project \
--billing-account=0X0X0X-0X0X0X-0X0X0X
# List billing accounts
gcloud billing accounts list
Enable Required APIs
Different services require specific APIs to be enabled:
# Enable Compute Engine API
gcloud services enable compute.googleapis.com
# Enable Cloud Storage API
gcloud services enable storage.googleapis.com
# Enable Kubernetes Engine API
gcloud services enable container.googleapis.com
# List all enabled services
gcloud services list
# List available services
gcloud services list --available
Configure IAM Roles
Set up appropriate access control for your project:
# Grant a user the Editor role
gcloud projects add-iam-policy-binding my-awesome-project \
--member=user:john@example.com \
--role=roles/editor
# Grant a service account the Viewer role
gcloud projects add-iam-policy-binding my-awesome-project \
--member=serviceAccount:my-service@my-awesome-project.iam.gserviceaccount.com \
--role=roles/viewer
# Get current IAM policy
gcloud projects get-iam-policy my-awesome-project
Service Account Setup
Service accounts are used for applications and services to authenticate with GCP:
# Create a service account
gcloud iam service-accounts create my-service-account \
--display-name="My Service Account" \
--description="Service account for application access"
# Grant roles to service account
gcloud projects add-iam-policy-binding my-awesome-project \
--member=serviceAccount:my-service-account@my-awesome-project.iam.gserviceaccount.com \
--role=roles/storage.objectAdmin
# Create and download service account key
gcloud iam service-accounts keys create key.json \
--iam-account=my-service-account@my-awesome-project.iam.gserviceaccount.com
Project Organization Best Practices
Naming Conventions
- Use consistent, descriptive project names
- Include environment indicators (dev, staging, prod)
- Use team or department prefixes when appropriate
Resource Labels
Apply labels to organize and track resources:
# Add labels to project
gcloud projects update my-awesome-project \
--update-labels=environment=production,team=engineering,cost-center=12345
# View project labels
gcloud projects describe my-awesome-project --format="flattened.labels"
Project Structure
Consider organizing projects by:
- Environment: Separate projects for dev, staging, production
- Team: Projects aligned with team boundaries
- Workload: Projects for specific applications or services
- Compliance: Isolated projects for regulated workloads
Security Configuration
Configure Organization Policies
If using Google Workspace/Cloud Identity:
# List available organization policy constraints
gcloud org-policies list --organization=ORGANIZATION_ID
# Set a policy (example: disable legacy APIs)
gcloud org-policies set-policy \
--organization=ORGANIZATION_ID \
policy.yaml
Network Configuration
Set up VPC networks and firewall rules:
# Create a VPC network
gcloud compute networks create my-network \
--subnet-mode=custom
# Create a subnet
gcloud compute networks subnets create my-subnet \
--network=my-network \
--region=us-central1 \
--range=10.0.0.0/24
Monitoring and Logging Setup
Enable monitoring and logging for your project:
# Create a monitoring workspace
gcloud monitoring workspaces create my-awesome-project
# Enable logging
gcloud logging buckets create my-log-bucket \
--location=global \
--retention-days=30
Common Issues and Troubleshooting
Project Creation Fails
- Verify you have project creation permissions
- Check if you’ve reached project quota limits
- Ensure billing account is valid
API Enablement Errors
- Verify API is available in your region
- Check if your billing account is active
- Ensure you have the necessary permissions
IAM Permission Issues
- Use
gcloud auth listto verify your authentication - Check your current role assignments
- Verify organization policy constraints
Cleanup Commands
# Delete service account
gcloud iam service-accounts delete my-service-account@my-awesome-project.iam.gserviceaccount.com
# Disable APIs
gcloud services disable compute.googleapis.com
# Unlink billing (only if project has no resources)
gcloud beta billing projects unlink my-awesome-project
# Delete project (caution: irreversible)
gcloud projects delete my-awesome-project
Jump to other sections
- Choose the right region for your resources
- Understand zones for high availability
- Explore Compute & Containers for deployment options
- Visit Networking & Security for security setup