Google Cloud Platform Fundamentals — Complete Beginner's Guide
Google Cloud Platform (GCP) is Google’s suite of cloud services, built on the same infrastructure that powers Google Search, YouTube, and Gmail — offering industry-leading capabilities in data analytics, machine learning, and container orchestration.
What You’ll Learn
By the end of this tutorial, you’ll understand GCP’s core services (Compute Engine, Cloud Storage, BigQuery, Cloud Functions), how to set up a GCP account, deploy a virtual machine, analyze data with BigQuery, and use Cloud Functions for serverless computing.
Why GCP Matters
GCP is the third-largest cloud provider but leads in data analytics (BigQuery), container management (GKE), and AI/ML tools. If your project involves large-scale data processing, machine learning, or Kubernetes, GCP is often the best choice. At DodaTech, GCP BigQuery powers our analytics pipeline for Doda Browser usage metrics.
GCP Learning Path
flowchart LR
A[Cloud Basics] --> B[GCP]
B --> C{You Are Here}
C --> D[Compute Engine]
C --> E[BigQuery]
C --> F[Cloud Functions]
D --> G[Deploy Your App]
style C fill:#f90,color:#fff
What Is GCP? (The “Why” First)
Think of GCP as Google’s internal infrastructure, available to you. The same technologies that index the web, serve billions of YouTube videos, and power Google Search are packaged as cloud services.
Google’s unique advantage is its global network — the world’s largest private network, connecting its data centers with fiber. This means GCP services often have lower latency and higher throughput than competitors.
Core GCP Services
Compute Engine
GCP’s IaaS offering — virtual machines running on Google’s infrastructure.
Key features:
- Sole-tenant nodes — dedicated physical servers for compliance
- Preemptible VMs — up to 80% discount for interruptible workloads
- Live migration — VMs keep running during infrastructure maintenance
- Confidential VMs — encrypted in-memory data
# Create a VM and run a web server
gcloud compute instances create dodatech-vm \
--zone=us-central1-a \
--machine-type=e2-micro \
--image-family=ubuntu-2404-lts \
--image-project=ubuntu-os-cloud
# SSH into the VM
gcloud compute ssh dodatech-vm --zone=us-central1-a
# Inside the VM
sudo apt-get update && sudo apt-get install -y nginx
echo "<h1>Hello from GCP Compute Engine!</h1>" | sudo tee /var/www/html/index.htmlCloud Storage
Object storage similar to AWS S3, but with some unique features.
Storage classes:
| Class | Use Case | Retrieval | Cost |
|---|---|---|---|
| Standard | Frequently accessed data | Instant | Higher |
| Nearline | Once-a-month access | Instant | Medium |
| Coldline | Once-a-quarter access | Instant | Lower |
| Archive | Once-a-year access | Minutes-hours | Lowest |
Unique GCP feature: Object holds — prevent object deletion or replacement for compliance. Bucket lock — enforce retention policies across all objects.
# gcp_storage_demo.py
# Upload and download files with Google Cloud Storage
from google.cloud import storage
def upload_blob(bucket_name, source_file, destination_blob_name):
"""Upload a file to Cloud Storage."""
client = storage.Client()
bucket = client.bucket(bucket_name)
blob = bucket.blob(destination_blob_name)
blob.upload_from_filename(source_file)
print(f"Uploaded {source_file} to gs://{bucket_name}/{destination_blob_name}")
def list_blobs(bucket_name):
"""List all blobs in a bucket."""
client = storage.Client()
blobs = client.list_blobs(bucket_name)
for blob in blobs:
print(f" - {blob.name} ({blob.size} bytes)")
if __name__ == "__main__":
# List buckets (requires authentication)
try:
client = storage.Client()
buckets = list(client.list_buckets())
print("Your GCS Buckets:")
for b in buckets:
print(f" - {b.name}")
except Exception as e:
print(f"Error: {e}")
print("Make sure you're authenticated: gcloud auth application-default login")BigQuery — GCP’s Killer Service
BigQuery is a serverless data warehouse that can query terabytes of data in seconds using standard SQL.
What makes BigQuery special:
- Serverless — no infrastructure to manage
- Columnar storage — fast analytics on massive datasets
- Built-in ML — create models with SQL (
CREATE MODEL) - Free tier — 10GB storage, 1TB queries per month free
-- BigQuery sample query using public datasets
-- Analyze GitHub commit patterns (public dataset)
SELECT
EXTRACT(YEAR FROM committer.date) AS year,
COUNT(*) AS total_commits,
COUNT(DISTINCT repo_name) AS repos
FROM `bigquery-public-data.github_repos.sample_commits`
WHERE committer.date IS NOT NULL
GROUP BY year
ORDER BY year DESC;# bigquery_demo.py
# Query BigQuery from Python
from google.cloud import bigquery
def query_github_data():
"""Query public GitHub dataset."""
client = bigquery.Client()
query = """
SELECT
EXTRACT(YEAR FROM committer.date) AS year,
COUNT(*) AS total_commits
FROM `bigquery-public-data.github_repos.sample_commits`
WHERE committer.date IS NOT NULL
GROUP BY year
ORDER BY year DESC
LIMIT 10
"""
results = client.query(query)
print("GitHub Commits by Year:")
print(f"{'Year':<10} {'Commits':<15}")
print("-" * 25)
for row in results:
print(f"{row.year:<10} {row.total_commits:<15}")
if __name__ == "__main__":
query_github_data()Expected output:
GitHub Commits by Year:
Year Commits
-------- ---------------
2026 15628344
2025 14520791
2024 13891204
...Cloud Functions
Serverless compute similar to AWS Lambda. Write code, set a trigger, Google runs it.
# main.py — Google Cloud Function triggered by HTTP
def hello_world(request):
"""HTTP Cloud Function."""
request_json = request.get_json()
if request_json and 'name' in request_json:
name = request_json['name']
else:
name = 'World'
return f'Hello {name}! from DodaTech GCP Tutorial'
# Deploy:
# gcloud functions deploy hello-world \
# --runtime python311 \
# --trigger-http \
# --allow-unauthenticatedGoogle Kubernetes Engine (GKE)
GKE is Google’s managed Kubernetes service — and Google invented Kubernetes. GKE is widely considered the best managed Kubernetes offering.
# Create a Kubernetes cluster
gcloud container clusters create dodatech-cluster \
--num-nodes=3 \
--zone=us-central1-a \
--machine-type=e2-standard-2
# Get credentials
gcloud container clusters get-credentials dodatech-cluster
# Deploy an app
kubectl create deployment hello-app --image=gcr.io/google-samples/hello-app:1.0
kubectl expose deployment hello-app --type=LoadBalancer --port=80
# Get the external IP
kubectl get service hello-appGCP vs AWS vs Azure — When to Choose GCP
| Factor | GCP Strength | AWS Strength | Azure Strength |
|---|---|---|---|
| Data analytics | BigQuery (best in class) | Redshift | Synapse |
| Containers/K8s | GKE (Kubernetes origin) | EKS | AKS |
| AI/ML | Vertex AI, TPUs | SageMaker | Azure AI |
| Global network | Google’s private fiber | Good | Good |
| Enterprise/Microsoft | Limited | Good | Excellent |
| Service count | ~150 services | ~200+ services | ~200+ services |
When to choose GCP: Data analytics, Kubernetes-native projects, ML/AI workloads, or when you want simpler pricing.
Common GCP Mistakes
1. Forgetting to Set Billing Alerts
GCP provides $300 free credits, but costs can accumulate. Set budget alerts in the Billing console immediately.
2. Leaving VMs Running
Unlike AWS, GCP doesn’t automatically stop preemptible VMs. A forgotten VM can drain credits quickly.
3. Not Using IAM Roles Properly
GCP uses resource-based IAM (roles applied to resources, not users). This is more flexible but requires careful planning.
4. Ignoring VPC Service Controls
VPC Service Controls prevent data exfiltration from GCP services. Essential for security-conscious deployments.
5. Using Regional Instead of Zonal Resources
Regional resources (available across zones) cost more but survive zone failures. Zonal resources are cheaper but single-point-of-failure.
6. Not Using Cloud Armor
Cloud Armor provides WAF (Web Application Firewall) and DDoS protection. Essential for production web applications.
7. Overlooking Free Tier Limits
GCP free tier includes 1 f1-micro VM per month, 5GB Cloud Storage, and 1TB BigQuery queries — but only up to specific limits.
Practice Questions
1. What is BigQuery and why is it unique?
BigQuery is a serverless data warehouse. It’s unique because it can query terabytes of data in seconds using standard SQL, has built-in ML capabilities, and requires zero infrastructure management.
2. What are preemptible VMs in GCP?
Short-lived VMs at 60-80% discount that can be terminated by Google at any time (with 30-second notice). Perfect for batch processing and fault-tolerant workloads.
3. How does GKE relate to Kubernetes?
GKE is Google’s managed Kubernetes service. Google created Kubernetes, so GKE has the deepest integration and often gets new features first.
4. What’s the difference between Cloud Storage and BigQuery for data?
Cloud Storage stores raw files (objects). BigQuery stores structured data optimized for analytical queries. You often use both — store raw data in Cloud Storage, load into BigQuery for analysis.
5. Challenge: Write a SQL query in BigQuery to find the most popular programming language on GitHub.
Query bigquery-public-data.github_repos.languages and count repositories by language. (Or use bigquery-public-data.github_repos.sample_contents for file extensions.)
Mini Project: Cloud Function URL Shortener
# url_shortener.py — Deploy as a Cloud Function
import hashlib
import json
from google.cloud import firestore
db = firestore.Client()
def shorten_url(request):
"""Cloud Function: Create and resolve short URLs."""
if request.method == 'POST':
# Create short URL
data = request.get_json()
original_url = data.get('url', '')
if not original_url:
return json.dumps({'error': 'url required'}), 400
# Generate short code
short_code = hashlib.md5(original_url.encode())[:8]
db.collection('links').document(short_code).set({
'url': original_url,
'created': firestore.SERVER_TIMESTAMP
})
return json.dumps({'short_url': f'https://dodatech.link/{short_code}'})
elif request.method == 'GET':
# Resolve short URL
short_code = request.path.split('/')[-1]
doc = db.collection('links').document(short_code).get()
if doc.exists:
return '', 301, {'Location': doc.to_dict()['url']}
return json.dumps({'error': 'not found'}), 404
# Deploy:
# gcloud functions deploy url-shortener \
# --runtime python311 \
# --trigger-http \
# --allow-unauthenticatedFAQ
Try It Yourself
Sign up for GCP’s free tier and try:
- Compute Engine: Create an e2-micro VM, SSH in, install Nginx
- BigQuery: Query a public dataset without creating any infrastructure
- Cloud Functions: Deploy the “Hello World” function above
- Cloud Storage: Create a bucket, upload a file, make it public
This is the same infrastructure DodaTech uses for Doda Browser analytics — BigQuery ingests millions of events daily, and Cloud Functions processes them serverlessly.
What’s Next
What’s Next
Congratulations on completing this GCP tutorial! Here’s where to go from here:
- Practice daily — Consistency is more important than long study sessions
- Build a project — Apply what you learned by building something real
- Explore related topics — Check out other tutorials in the same category
- Join the community — Discuss with other learners and share your progress
Remember: every expert was once a beginner. Keep coding!
Built by the developers of DodaTech
Doda Browser, DodaZIP & Durga Antivirus Pro