Skip to main content
Quick Reference

Google Cloud Cheatsheet

Google Cloud on one page — projects, IAM, VPC, Compute Engine, and the traps around zones, service accounts, and storage class.

10 sections 10 tables 14 code snippets

Project and zone

Which project the CLI will use

gcloud config get-value project

A VM lives in one zone

# --zone=asia-south1-a

The hierarchy

PieceMeaning
OrganizationThe top of the tree. A role here flows down through folders and projects
ProjectThe boundary for APIs, IAM, and the bill. The project ID is globally unique and cannot be changed
Project nameA label. You can rename it. The ID and the project number stay put
ZoneA VM, and a zonal disk, exist in one zone inside a region such as asia-south1
Wrong contextThe wrong project or the wrong zone makes the resource look missing
DeleteA deleted project can be restored for about 30 days. The ID stays taken during that window

This page is Google Cloud. AWS is left out.

IAM and service accounts

A key file wins

# GOOGLE_APPLICATION_CREDENTIALS hides the attached service account

Who the call runs as

PieceMeaning
Allow policyGrants a role to a principal at a scope. Child resources inherit it
Deny policyBlocks a permission even when a role allows it. Deny wins
Owner, Editor, ViewerBroad basic roles. Prefer a predefined role such as roles/storage.objectViewer
Service accountAn identity for a workload. Grant roles to it for what it may call
Attach itThe person who binds a service account onto a VM also needs permission on that account
Default compute accountOlder projects gave it Editor. Use a dedicated account for the workload

VPC

APIs are not the internet

# Private Google Access reaches Google APIs, not the public internet

Global network, regional subnets

PieceMeaning
VPCGlobal, including its routes and firewall rules. Subnets are regional
Custom modeStarts with the implied rules only. Auto mode adds a subnet in every region
Implied rulesDeny all inbound and allow all outbound, at the lowest priority. You cannot delete them
Your rulesAllow or deny. A lower priority number is checked first. A target tag limits which VMs match
Private Google AccessA subnet setting. VMs with no external IP can call Google APIs. The public internet stays closed
Cloud NATOutbound internet for VMs that have no external IP. It is regional

Compute Engine

Stop the vCPU charge

gcloud compute instances stop web-01 --zone=asia-south1-a

Scratch disk

# local SSD is wiped when the VM stops

What survives a stop

PieceMeaning
StopEnds the vCPU and memory charge. Persistent disks and a static external IP keep billing
Ephemeral IPReleased on stop. A static external IP stays reserved and keeps billing
Persistent diskSurvives stop. A zonal disk cannot attach to a VM in another zone
Local SSDWiped on stop and on delete
Machine typeChanged only while the VM is stopped
SpotCheaper, and Google can preempt it with about 30 seconds of notice

Cloud Storage

Upload one object

gcloud storage cp report.csv gs://logs-prod/2026/report.csv

Still online

# Archive still returns the object in milliseconds

Buckets and classes

PieceMeaning
Name and placeThe name is global. The location is chosen at creation and cannot be changed
ClassesStandard, Nearline (30-day minimum), Coldline (90), Archive (365). Early delete is still billed
ArchiveOnline. A read is milliseconds, plus a retrieval fee. It is not an offline restore
Uniform accessOne IAM policy for the bucket. Per-object ACLs are off
Public access preventionWhen enforced, a grant to allUsers is rejected
VersionsWith versioning, delete keeps a noncurrent generation. Soft delete can retain a removed object as well

Cloud SQL and BigQuery

Failover is not a read copy

# the HA standby is not open for reads

You pay for the scan

# BigQuery bills the bytes the query reads

Two data services

PieceMeaning
Cloud SQL HAA standby in another zone of the same region. It is synchronous, and it is not a read endpoint
Read replicaAsync, with its own address. It can sit in another region. It is not the HA standby
Enable HA laterSwitching a zonal instance to regional restarts it
BigQueryOn-demand pricing charges the bytes processed. A SELECT of every column reads those columns
PartitionA filter on the partition column skips other partitions. A filter on a normal column does not
Index missFirestore rejects a query that has no matching index. It does not scan the whole database

Cloud Run

The default clock

# the default request timeout is 300 seconds

The service

PieceMeaning
Timeout300 seconds unless you set it. The ceiling is 60 minutes
1st gen functionsCap at 9 minutes. 2nd gen functions run on Cloud Run
Scale to zeroWith no minimum instances, the next request can cold-start. A minimum above zero stays billed
ConcurrencyOne instance can handle many requests. The default is 80
Invokerroles/run.invoker decides who can call it. allUsers makes it public
Runtime accountThe identity the container uses for Google APIs. It is separate from the invoker

Secret Manager

The role that reads the value

# roles/secretmanager.secretAccessor

Payload versus admin

PieceMeaning
secretAccessorReads secret versions. This is the role the runtime account needs
AdminCreates secrets and sets IAM. Admin is more than a read
EditorThe basic Editor role does not include reading secret payloads
Env varA Cloud Run env secret is fixed when the instance starts. A new version needs a new instance
Mounted fileA mount of the latest version is read when that instance starts
JSON keyA downloaded service-account key is long-lived. Prefer the attached account

Cost

What keeps charging

PieceMeaning
Data inIngress is free. Egress to the internet is billed. Traffic between zones is billed too
Stopped VMvCPU and memory stop. Disks and a static external IP continue
SpotA large discount, with preemption. A committed use discount is a 1-year or 3-year commit
BudgetSends an alert. It does not stop resources by itself
LabelsShow up in the billing export. They do not change the rate
Nearline and colderRetrieval fees plus the minimum duration, even if you delete early

Interview traps

Two different logins

# gcloud auth login does not set application default credentials

Deny beats allow

# a deny policy overrides an allow

Traps worth memorising

TrapWhat happensPrefer
Wrong project or zoneThe VM looks missinggcloud config get-value project and --zone
gcloud auth loginThe CLI is signed in. Client libraries still use ADC or a JSON keygcloud auth application-default login, or the attached account
Key file on the VMClient libraries ignore the attached service accountUnset GOOGLE_APPLICATION_CREDENTIALS
HA standbyNot open for reads or writesA read replica for read traffic
Archive means offlineThe object is still served in milliseconds. Early delete before 365 days is billedArchive for rare reads, Standard for active ones
Editor on the projectDoes not read Secret Manager payloadsroles/secretmanager.secretAccessor on the runtime account

How to use this page: confirm the project and the zone, then the service account, before you debug the resource.