GCP Fundamentals
Understand Google Cloud Platform architecture, global infrastructure, and how to navigate the Console and CLI.
Simple Explanation (ELI5)
Google Cloud Platform (GCP) is a cloud provider like AWS and Azure. Imagine GCP as a global network of data centers. You can rent computers (VMs), storage buckets, databases, and other services without owning hardware. GCP organizes its infrastructure into Regions (geographic areas) and Zones (specific data centers within regions). Everything runs in these zones, and you choose where your data lives.
Why Do We Need It?
- GCP provides a complete, integrated platform: Compute + Storage + Databases + AI/ML + Analytics all work together seamlessly.
- Multi-region deployment ensures your applications are close to users and survive data center failures.
- GCP Console and CLI let you provision infrastructure in minutes instead of weeks.
- Pricing is transparent and often cheaper than competitors for long-running workloads.
- GCP excels at data analytics (BigQuery) and machine learning workflows.
Technical Explanation
GCP is organized hierarchically: Domains (your organization) contain Projects (isolated billing units), which contain Resources (VMs, databases, networks). Each project runs in one or more Regions. Each Region contains 2+ independent Zones. Zones are connected by very low-latency links within a region, but inter-regional traffic incurs bandwidth fees.
GCP Infrastructure Model
| Level | Description | Example |
|---|---|---|
| Organization | Top-level container (optional) | Acme Corporation |
| Project | Billing and resource grouping | my-app-prod |
| Region | Geographic area (e.g., us-central1) | us-central1 (Iowa) |
| Zone | Specific data center | us-central1-a |
| Resource | Compute, storage, database instances | VM instance, Cloud Storage bucket |
Key GCP Regions & Zones
| Region | Geography | Use Case |
|---|---|---|
| us-central1 | Iowa, USA | Default, most services available |
| us-east1 | South Carolina, USA | US East Coast services |
| us-west1 | Oregon, USA | US West Coast services |
| europe-west1 | Belgium, Europe | GDPR compliance, European users |
| asia-east1 | Taiwan, Asia | Southeast Asian users |
GCP Console & CLI
1. GCP Console (Web UI)
The GCP Console is your web-based dashboard at console.cloud.google.com. You can:
- Create and manage projects
- Deploy VMs, databases, and services via UI wizards
- Monitor logs and metrics
- Set up billing and IAM roles
- View documentation embedded in the console
2. GCP CLI (gcloud)
The gcloud CLI is the command-line interface for GCP. Install it and authenticate:
curl https://sdk.cloud.google.com | bash exec -l $SHELL gcloud init gcloud auth login
Common gcloud Commands
# Set default project gcloud config set project MY_PROJECT_ID # Create a Compute Engine VM gcloud compute instances create my-vm --zone us-central1-a --machine-type n1-standard-1 # List all VMs gcloud compute instances list # SSH into a VM gcloud compute ssh my-vm --zone us-central1-a # View current configuration gcloud config list # Enable a service (e.g., Compute Engine API) gcloud services enable compute.googleapis.com
Hands-on: First Steps in GCP
- Create a GCP project: Visit console.cloud.google.com, click the project dropdown, and select "New Project". Name it "my-first-project".
- Enable Compute Engine API: Search for "Compute Engine" in the console and click "Enable".
- Install gcloud CLI locally (see steps above).
- Authenticate: Run
gcloud initand select your new project. - List available zones:
gcloud compute zones list
Debugging Scenarios
Scenario 1: "gcloud: command not found"
Symptom: You installed the SDK but gcloud CLI is not available in your terminal.
- Check the installation directory: usually ~/google-cloud-sdk/bin.
- Add it to your PATH:
export PATH=$PATH:~/google-cloud-sdk/bin - Restart your terminal or run
source ~/.bashrc
Scenario 2: "Default credentials have not been set"
Symptom: Running a gcloud command fails with authentication error.
- Run
gcloud auth loginto authenticate with your Google account. - Ensure you are logged in to the right account:
gcloud auth list - Set the active account:
gcloud config set account YOUR_EMAIL
Interview Questions
Beginner
GCP is Google's cloud platform offering compute, storage, databases, and analytics services globally. vs AWS: AWS is older with broader service catalog; GCP excels at data analytics and machine learning. vs Azure: Azure integrates with Microsoft ecosystem; GCP is developer-friendly and cheaper for analytics workloads.
A Project is a container for resources with its own billing, IAM roles, and APIs. All GCP resources (VMs, buckets, databases) belong to a project.
A Region is a geographic area (e.g., us-central1). A Zone is a specific data center within a region (e.g., us-central1-a). Zones within a region have very low latency; inter-region traffic is slower and costlier.
Run gcloud auth login, which opens your browser to authenticate. You can also use service account keys for automation.
Cloud Storage. Both offer object storage with similar pricing and redundancy models. Bucket names must be globally unique.
Intermediate
Organization → Folders → Projects → Resources. This allows centralized billing and IAM policies at the organization level that cascade to all projects and resources.
Zones are independent. You choose based on: (1) resource availability (not all services in all zones), (2) diversification for fault tolerance (spread instances across zones), (3) latency to users within the region.
1. Create a project, 2. Enable the required API (e.g., Compute Engine), 3. Set billing, 4. Create the resource via Console or CLI, 5. Assign IAM roles for access.
GCP only allows API calls after the API is explicitly enabled on the project. Without enabling, requests fail with "API not enabled" errors. This improves security (only enabled services consume quota and can be billed).
Scenario-based
Deploy instances in us-central1 for US traffic and europe-west1 for European traffic. Use a global load balancer to route requests to the nearest region. Replicate data across regions respecting GDPR residency requirements.
Real-world Usage
Most GCP projects start by creating a project, enabling Compute Engine, and launching a test VM. As workloads grow, teams organize with folders (dev/stage/prod), implement centralbudgeting, and configure IAM roles per team. BigQuery often becomes the analytics backbone for downstream analysis.
Summary
GCP is a powerful cloud platform with a clear hierarchical organization (Org → Project → Zone → Resource). The Console offers UI-based management; gcloud CLI enables automation. Zones and regions are key to latency and redundancy strategies. Mastering these fundamentals sets the foundation for deploying compute, storage, databases, and everything else in GCP.