TechLead
Lesson 3 of 25
5 min read
Cloud & Kubernetes

GCP Core Services

Explore Google Cloud Platform's essential services including Compute Engine, Cloud Storage, BigQuery, Cloud Run, and GKE

Google Cloud Platform (GCP) Overview

Google Cloud Platform provides a suite of cloud computing services that run on the same infrastructure Google uses internally for its end-user products like Google Search, YouTube, and Gmail. GCP is especially strong in data analytics, machine learning, Kubernetes (GKE), and serverless computing.

GCP Core Services by Category

  • Compute: Compute Engine, Cloud Run, Cloud Functions, GKE, App Engine
  • Storage: Cloud Storage, Persistent Disks, Filestore
  • Database: Cloud SQL, Cloud Spanner, Firestore, Bigtable
  • Analytics: BigQuery, Dataflow, Pub/Sub, Dataproc
  • Networking: VPC, Cloud Load Balancing, Cloud CDN, Cloud DNS
  • AI/ML: Vertex AI, AutoML, Vision API, Natural Language API

Compute Engine

Compute Engine provides virtual machines (VMs) running on Google's infrastructure. It offers predefined and custom machine types, preemptible/spot VMs for cost savings, and sole-tenant nodes for compliance.

# Create a Compute Engine instance
gcloud compute instances create my-web-server \
  --zone=us-central1-a \
  --machine-type=e2-medium \
  --image-family=ubuntu-2204-lts \
  --image-project=ubuntu-os-cloud \
  --boot-disk-size=20GB \
  --tags=http-server,https-server \
  --metadata=startup-script='#!/bin/bash
    apt-get update
    apt-get install -y nginx
    systemctl start nginx'

# List instances
gcloud compute instances list

# SSH into an instance
gcloud compute ssh my-web-server --zone=us-central1-a

# Create a firewall rule for HTTP traffic
gcloud compute firewall-rules create allow-http \
  --direction=INGRESS \
  --priority=1000 \
  --network=default \
  --action=ALLOW \
  --rules=tcp:80 \
  --target-tags=http-server

Cloud Storage

Cloud Storage is a unified, scalable, and highly durable object storage service. It offers multiple storage classes optimized for different use cases, from frequently accessed data to long-term archives.

# Create a bucket
gsutil mb -l us-central1 gs://my-app-bucket-2026/

# Upload files
gsutil cp -r ./build/* gs://my-app-bucket-2026/

# Sync a directory
gsutil rsync -r -d ./dist gs://my-app-bucket-2026/static/

# Set up static website hosting
gsutil web set -m index.html -e 404.html gs://my-app-bucket-2026/

# Make bucket publicly readable
gsutil iam ch allUsers:objectViewer gs://my-app-bucket-2026/

# Set lifecycle rules to move objects to cheaper storage
gsutil lifecycle set lifecycle.json gs://my-app-bucket-2026/

Storage Classes

Class Min Duration Use Case Availability SLA
StandardNoneFrequently accessed data99.99%
Nearline30 daysAccessed < once/month99.9%
Coldline90 daysAccessed < once/quarter99.9%
Archive365 daysLong-term archival99.9%

Cloud Run

Cloud Run is a fully managed platform that automatically scales your containerized applications. You bring a container image, and Cloud Run handles the infrastructure. It is built on the open standard Knative, making your apps portable.

# Build and deploy a container to Cloud Run
gcloud builds submit --tag gcr.io/my-project/my-app

gcloud run deploy my-app \
  --image gcr.io/my-project/my-app \
  --platform managed \
  --region us-central1 \
  --allow-unauthenticated \
  --port 3000 \
  --memory 512Mi \
  --cpu 1 \
  --min-instances 0 \
  --max-instances 10 \
  --set-env-vars "NODE_ENV=production,DATABASE_URL=postgres://..."

# View service details
gcloud run services describe my-app --region us-central1

# View logs
gcloud run services logs read my-app --region us-central1

BigQuery

BigQuery is a fully managed, serverless data warehouse that enables super-fast SQL queries using the processing power of Google's infrastructure. It can analyze terabytes of data in seconds and petabytes in minutes.

# Query a public dataset
bq query --use_legacy_sql=false '
  SELECT
    name,
    SUM(number) as total
  FROM `bigquery-public-data.usa_names.usa_1910_current`
  WHERE year > 2000
  GROUP BY name
  ORDER BY total DESC
  LIMIT 10
'

# Load data from Cloud Storage
bq load --autodetect \
  --source_format=CSV \
  my_dataset.my_table \
  gs://my-bucket/data.csv

# Create a dataset
bq mk --dataset my_project:my_dataset

GKE — Google Kubernetes Engine

GKE is a managed Kubernetes service that provides a production-ready environment for deploying containerized applications. Google invented Kubernetes, and GKE is widely considered the most mature managed Kubernetes offering.

# Create a GKE cluster
gcloud container clusters create my-cluster \
  --zone us-central1-a \
  --num-nodes 3 \
  --machine-type e2-standard-2 \
  --enable-autoscaling --min-nodes 1 --max-nodes 5

# Get credentials for kubectl
gcloud container clusters get-credentials my-cluster --zone us-central1-a

# Deploy an application
kubectl create deployment my-app --image=gcr.io/my-project/my-app:latest
kubectl expose deployment my-app --type=LoadBalancer --port=80 --target-port=3000

Key Takeaways

  • GCP excels in data analytics (BigQuery), Kubernetes (GKE), and serverless (Cloud Run)
  • Compute Engine provides flexible VMs with custom machine types and preemptible instances
  • Cloud Storage offers multiple storage classes for cost optimization
  • Cloud Run simplifies container deployment with automatic scaling to zero
  • GKE is the most mature managed Kubernetes offering, built by the creators of Kubernetes

Continue Learning