GCP · 101 Guide
Google Cloud 101 — the mental model, core services, and your first deploy
A from-scratch guide to Google Cloud for technical people new to it: the resource hierarchy, IAM, compute, storage, networking, databases, billing, observability, and a copy-ready Cloud Run deploy you tear down at the end.
01What GCP is, and the mental model
Google Cloud (GCP) is a rented slice of Google's own infrastructure, billed by usage. Four ideas make everything else click.
Regions and zones
GCP runs in regions (e.g. us-central1, europe-west1) — geographic areas — each split into zones (us-central1-a, -b, -c), which are independent failure domains inside that region. A zone failing should not take its siblings down. Pick a region close to your users (latency) and your data (compliance), and spread anything that must stay up across multiple zones. Some services are zonal (a VM, a disk), some regional (a subnet, a regional bucket), and a few are global (the VPC network itself, Cloud Storage buckets' namespace, global load balancers).
Three ways to touch everything
Every resource can be driven three ways, and they all hit the same API:
- Console — the web UI at
console.cloud.google.com. Good for exploring and one-offs. - `gcloud` CLI — scriptable, reproducible, what you will actually live in. This guide uses it.
- Infrastructure as Code — Terraform or Google's Deployment Manager. The right answer for anything you want to recreate, review, or roll back.
Click in the console to learn; commit to gcloud and IaC for anything real.
Shared responsibility
Google secures the hardware, the physical network, and the managed service itself. You are responsible for your data, your IAM permissions, your firewall rules, and your code. The more managed the service (Cloud Run vs a raw VM), the more of the stack Google owns — but IAM and data classification are always yours.
Pay-per-use
There is no flat fee. You pay for compute-seconds, gigabytes stored, and gigabytes of network egress (data leaving GCP). Idle-but-running resources still bill. This is the single biggest source of surprise invoices, so the hierarchy and billing sections below matter as much as the compute one.
02Accounts & organization
GCP's structure is a tree: Organization → Folders → Projects → Resources.
The project is the unit that matters
A Project is the fundamental container. Every resource lives in exactly one project, and the project is the boundary for billing, IAM, quotas, and API enablement. Projects have a human name, a globally unique project ID (e.g. acme-shop-prod, chosen once and permanent), and an auto-generated numeric project number. A project is cheap to create and the cleanest way to isolate blast radius: delete the project and everything in it goes with it.
Organization and folders
The Organization is the root node, tied to a Google Workspace or Cloud Identity domain. It is where org-wide policy and the ultimate ownership live. Folders group projects — typically by department, team, or environment — and let you set IAM and policy once and have it inherit downward. A permission or org policy granted at a folder flows to every project beneath it.
Recommended layout
- One project per app per environment:
myapp-dev,myapp-staging,myapp-prod. This isolates failures, quotas, and billing, and lets you grant a developer full rein in-devand read-only in-prod. - Folders by team or domain, with a separate folder for shared/platform resources.
- A dedicated billing account at the org level that projects link to.
Resist the urge to cram everything into one project. Separate projects are the cheapest, strongest isolation GCP gives you.
03Identity & access (IAM)
Cloud IAM answers one question: who can do what on which resource? It is built from three parts.
Members, roles, bindings
- Member (the *who*): a Google user, a Google group, a domain, or a service account (a non-human identity for code).
- Role (the *what*): a named bundle of permissions, e.g.
roles/storage.objectViewer. There are basic roles (Owner/Editor/Viewer — too broad, avoid in prod), predefined roles (scoped per service — prefer these), and custom roles. - Binding (the glue): an IAM policy on a resource attaches members to roles.
member + role on a resource = a binding.
gcloud projects add-iam-policy-binding PROJECT_ID \ --member="user:dev@example.com" \ --role="roles/run.developer"
Least privilege
Grant the narrowest predefined role that does the job, prefer groups over naming individuals, and scope the binding to the smallest resource (a single bucket, not the whole project). Never hand out roles/owner to a service that only needs to read one bucket.
Service accounts
Code authenticates as a service account, not as you. On GCP compute (a VM, Cloud Run, GKE) the attached service account's credentials are injected automatically — your code calls google.auth.default() and it just works, no keys to manage. Avoid downloading service-account key files; a leaked key is a standing credential. Use Workload Identity or attached service accounts instead.
How a request resolves
When a member calls an API, IAM gathers the policy on the resource plus every policy inherited from its project, folders, and org, and checks whether any binding grants the required permission. Allow is additive and inheritance only grants — a broad grant higher up cannot be narrowed by a lower one (for that you need org policies or deny policies). So keep high-level grants tight.
04Compute — how to run code
Four main ways to run code, from most managed to least. Pick by how much you want to own.
Cloud Run — start here
Fully managed, containerized, scales to zero. You hand it a container image; it runs it behind HTTPS, autoscales on request volume, and bills only while requests are in flight. No servers to patch. Choose it for web apps, APIs, event consumers, and most stateless services. It is the default modern choice and what the hands-on section uses.
Cloud Functions — small event glue
Single-purpose functions triggered by an HTTP call or an event (a file lands in a bucket, a Pub/Sub message). Choose it for lightweight glue and automation. For anything larger, Cloud Run gives you more control for similar effort — the two have largely converged.
GKE (Google Kubernetes Engine) — when you need Kubernetes
Managed Kubernetes. Powerful, and powerfully complex. Choose it when you genuinely need Kubernetes: complex multi-service topologies, stateful workloads, fine-grained orchestration, or an existing k8s investment. Autopilot mode removes node management and bills per-pod. Do not reach for GKE to run one container — that is Cloud Run's job.
Compute Engine (GCE) — raw VMs
Virtual machines you own end to end: OS, patching, scaling. Choose it when you need a specific OS, GPUs, licensed software, long-running stateful processes, or lift-and-shift of a legacy app. Cost control levers: committed-use discounts (1–3 yr) for steady loads, and Spot VMs (deeply discounted, can be preempted) for fault-tolerant batch work.
Rule of thumb: stateless HTTP or events → Cloud Run. Need Kubernetes → GKE. Need a whole machine → Compute Engine.
05Storage
Three shapes of storage; match the shape to the access pattern.
Cloud Storage — object (the default durable store)
Buckets holding objects (files), accessed over an API, not a filesystem. Globally unique bucket names, 11 nines of durability, effectively unlimited scale. Use it for images, backups, data lakes, static assets, logs — anything you read/write whole. This is where durable data lives by default.
Storage classes trade price-per-GB against retrieval cost: Standard (hot, frequent access), Nearline (~monthly), Coldline (~quarterly), Archive (cheapest storage, priciest/slowest retrieval). Lifecycle rules automatically transition or delete objects by age:
gcloud storage buckets create gs://BUCKET_NAME --location=REGION # then attach a lifecycle config to auto-move objects to Coldline after 90 days
Persistent Disk — block
Network-attached block storage for a VM — behaves like a raw disk you format and mount. SSD or balanced/standard HDD. Use it for a VM's boot disk and databases or filesystems that need low-latency block access. A disk is zonal (or regional for sync replication) and attaches to Compute Engine.
Filestore — file
Managed NFS shared filesystem. Use it when multiple VMs need a POSIX filesystem mounted at the same path — shared application state, legacy apps expecting a mount. More expensive per GB than object storage; only reach for it when you truly need shared-file semantics.
Default to Cloud Storage. Use Persistent Disk because a VM needs a disk, and Filestore only when an app demands a shared mount.
06Networking
GCP's virtual network is a software-defined network you configure, not cables you rack.
VPC — global
A VPC network is global — one VPC spans every region, no peering needed between regions. Inside it you carve subnets, and each subnet is regional with its own private IP range (CIDR). Resources in different subnets of the same VPC route to each other privately by default.
Public vs private
A resource with only an internal IP is reachable from inside the VPC but not the internet — the right default for databases and backends. An external IP makes it internet-reachable. Private resources reach the internet for updates through Cloud NAT (outbound only, no inbound exposure). Keep data stores private; expose only a load balancer or gateway.
Firewall rules
VPC firewall rules allow or deny traffic by protocol, port, and source/target — attached to the network and applied via network tags or service accounts. Rules are stateful (return traffic is allowed automatically). Default-deny inbound, and open only the ports you need:
gcloud compute firewall-rules create allow-https \ --network=VPC_NAME --direction=INGRESS --action=ALLOW \ --rules=tcp:443 --source-ranges=0.0.0.0/0 --target-tags=web
Load balancing
Cloud Load Balancing distributes traffic across backends. The global external Application (HTTP/S) Load Balancer gives you a single anycast IP, routes users to the nearest healthy backend across regions, and terminates TLS. Use it to front Compute Engine, GKE, or (via a serverless NEG) Cloud Run. Managed Cloud Run already includes HTTPS and autoscaling, so you only add a load balancer for custom domains, multi-region, or a shared WAF/CDN edge.
07Databases
Managed databases mean Google handles patching, backups, replication, and failover. Pick by data model and access pattern.
Cloud SQL — managed relational
Managed PostgreSQL, MySQL, or SQL Server. Full SQL, transactions, joins — the default for most apps and anything with relational integrity. Supports high availability (regional failover) and automated backups. Use it for standard transactional workloads. If you outgrow a single primary's scale, look at Spanner (globally distributed, horizontally scalable relational with strong consistency — powerful and pricier).
Firestore — serverless document NoSQL
Serverless, autoscaling document database with real-time listeners and offline sync. Use it for web/mobile app data, user profiles, and flexible schemas where you want zero ops and scale-to-zero economics.
Bigtable — wide-column at massive scale
Low-latency wide-column store for huge datasets — time-series, IoT, analytics, adtech — at millions of ops/sec. Use it when you have very high throughput and a known key-based access pattern. Overkill for a normal app.
Memorystore — in-memory cache
Managed Redis or Memcached. Use it for caching, session stores, rate limiting, and leaderboards — not durable primary storage. It fronts your real database to cut latency and load.
Decision shortcut: relational/transactions → Cloud SQL (Spanner if you need global scale); flexible app documents → Firestore; enormous key-based throughput → Bigtable; a cache in front of any of them → Memorystore.
08Billing & cost control
You pay per use, invoiced to a billing account that one or more projects link to. Knowing what bills — and what surprises people — keeps the invoice sane.
The four things that surprise people
- Egress: inbound data is free; data leaving GCP (to the internet or across regions) is billed per GB. Chatty cross-region traffic and large downloads add up fast.
- Always-on resources: a stopped VM still bills for its disk and reserved static IP; an idle load balancer, a provisioned Cloud SQL instance, and an unattached disk all bill whether or not you use them. Scale-to-zero services (Cloud Run) are the exception.
- Premium tiers and logging: verbose logs retained, NAT data processing, and premium network tiers quietly accrue.
- Forgotten dev resources: the number-one real-world cause. A spun-up test VM or database left running over a weekend.
Controls to set up on day one
- Budgets & alerts: set a budget on the billing account with email alerts at 50/90/100%. Alerts notify; they do not cap spend.
gcloud billing budgets create --billing-account=BILLING_ACCOUNT_ID \ --display-name="monthly-cap" --budget-amount=100USD
- Labels: tag every resource with
labelsliketeam,env,app. Billing export then lets you slice cost by label to see *who* and *what* is spending. - Billing reports in the console: your first stop to see the trend and the top services.
- Quotas: per-project limits that also act as a safety ceiling against runaway usage.
Label from the start — retrofitting labels onto months of untagged resources is miserable.
09Observability
Telemetry lives in the Google Cloud Observability suite (formerly Stackdriver), on by default for most services.
Cloud Logging
Central log store. Managed services (Cloud Run, GKE, Load Balancing) write logs here automatically — anything your app prints to stdout/stderr is captured. Query with the Logs Explorer and its filter language:
gcloud logging read 'resource.type="cloud_run_revision" severity>=ERROR' --limit=50
Set log-based metrics to turn a log pattern (e.g. count of 500s) into a graphable, alertable metric, and sinks to export logs to a bucket or BigQuery for retention and analysis.
Cloud Monitoring
Metrics, dashboards, uptime checks, and alerting policies. System metrics (CPU, request latency, instance count) arrive automatically; you add custom metrics for app-level signals. Wire an alerting policy to a notification channel (email, PagerDuty, Slack) so you hear about an SLO breach before your users do.
Audit Logs
A distinct, security-critical stream: who did what, where, and when on the control plane. Admin Activity logs (IAM changes, resource creation/deletion) are always on; Data Access logs are opt-in. This is your forensic record for security and compliance questions.
First place to look in an incident
Start in Cloud Monitoring to see *what* broke and *when* (the latency or error-rate spike), then pivot to Cloud Logging filtered to that service and time window to find *why*. If the trigger was a config or permission change, Audit Logs tell you *who* changed it.
10Your first deploy (hands-on)
Deploy a container to Cloud Run, verify its URL, then delete it. Cloud Run scales to zero, so a quick test costs effectively nothing — but we tear it down anyway. You need the gcloud CLI installed and a project with billing enabled.
1. Authenticate and set context
gcloud auth login gcloud config set project PROJECT_ID gcloud config set run/region REGION # e.g. us-central1
Verify: gcloud config list shows your project and region.
2. Enable the APIs
Services are off until enabled per project.
gcloud services enable run.googleapis.com \ artifactregistry.googleapis.com cloudbuild.googleapis.com
Verify: gcloud services list --enabled lists all three.
3. Deploy a container
We deploy Google's public sample image so there is nothing to build. (This creates billable resources — minimal on Cloud Run, but real.)
gcloud run deploy SERVICE_NAME \ --image=us-docker.pkg.dev/cloudrun/container/hello \ --allow-unauthenticated \ --region=REGION
--allow-unauthenticated makes it publicly reachable — fine for this test, not a default for real services. The command prints a Service URL when it finishes.
4. Verify it's running
SERVICE_URL=$(gcloud run services describe SERVICE_NAME \ --region=REGION --format='value(status.url)') curl "$SERVICE_URL"
You should get an HTML "Congratulations" page. Open $SERVICE_URL in a browser to confirm. Check logs with:
gcloud run services logs read SERVICE_NAME --region=REGION --limit=20
5. Tear it down (do this to avoid charges)
gcloud run services delete SERVICE_NAME --region=REGION --quiet
Verify removal: gcloud run services list --region=REGION no longer shows it. Deleting the service removes the running resource; the sample image is public and costs you nothing. If this were a project you created solely to experiment, deleting the project (gcloud projects delete PROJECT_ID) is the surest way to stop every associated charge.
11Where to go next
You now have the mental model and a deploy under your belt. From here:
- GCP Cheat Sheet — the terse
gcloudcommand reference for day-to-day work: projects, IAM bindings, Compute Engine, Cloud Storage, VPC, and Cloud Run, all as copy-ready one-liners. Keep it open in a second tab. - GCP SRE Sheet — the operations companion: SLOs and error budgets, alerting policies, incident response with Cloud Monitoring and Logging, and the reliability patterns (health checks, multi-zone, Cloud NAT) referenced above.
- Cloud Landing Zones — once you move past a single project, this covers the org/folder/project structure, shared VPC, org policies, and billing guardrails for a production-grade foundation.
Good habits to carry forward: prefer gcloud and IaC over clicking; one project per app per environment; least-privilege IAM with predefined roles and service accounts; a budget with alerts and labels on everything; and tear down what you are only testing.