Google Cloud Cheatsheet

Cost and Free Tier

Use this Google Cloud reference while you build software engineering projects, review code for technical interview prep, or polish examples for a software engineer resume.

Always-Free Tier (no expiry)

ServiceFree allowance per month
Compute Engine1 e2-micro VM in us-west1, us-central1, or us-east1
Cloud Storage5 GB standard storage (US regions only) + 1 GB network egress
BigQuery1 TB query processing + 10 GB storage
Cloud Run2 million requests, 360,000 GB-sec memory, 180,000 vCPU-sec
Cloud Functions2 million invocations, 400,000 GB-sec, 200,000 GHz-sec
Pub/Sub10 GB messages
Cloud Firestore1 GB storage, 50k reads, 20k writes, 20k deletes per day
Cloud Build120 build-minutes per day
Artifact Registry0.5 GB storage
Secret Manager6 active secret versions, 10k access operations
Cloud LoggingFirst 50 GB log ingestion
Cloud Monitoring150 MB metric ingestion
Cloud ShellFree interactive terminal (ephemeral VM)
Maps Platform$200/month credit (covers most small apps)

The free-tier Compute Engine e2-micro does not count toward the 90-day trial credit — it is always free.

90-Day Free Trial

  • $300 USD credit applied to your billing account.
  • Valid for 90 days from account activation.
  • Covers almost all services.
  • Ends when credit is exhausted or 90 days pass — whichever comes first.
  • No auto-charge at end; you must manually upgrade to a paid account.

Pricing Fundamentals

Compute Engine

On-demand pricing = vCPU cost + memory cost + disk cost + network egress
Discount typeHowSavings
Sustained useAuto-applied for >25% of monthUp to 30%
Committed use (1yr)Pre-pay for 1 yearUp to 37%
Committed use (3yr)Pre-pay for 3 yearsUp to 57%
Spot VMsPreemptible, available capacityUp to 91%
Custom machine typesRight-size vCPU/RAMAvoid over-provisioning

Cloud Storage

ClassStorage per GB/monthRetrieval per GBMin duration
Standard$0.020
Nearline$0.010$0.0130 days
Coldline$0.004$0.0290 days
Archive$0.0012$0.05365 days

Network egress charges apply (within-region is free; cross-region varies; internet egress from $0.08/GB).

BigQuery

ItemCost
On-demand queries$6.25 per TB scanned
First 1 TB/monthFree
Active storage$0.02 per GB/month
Long-term storage (90+ days unchanged)$0.01 per GB/month
Streaming inserts$0.01 per 200 MB
Capacity (BigQuery Editions)Standard $0.04 / Enterprise $0.06 per slot-hour (autoscaling; legacy flat-rate is retired)

Cloud Run

ItemFree tierPrice above free
Requests2M/month$0.40 per million
CPU (invocation)360k vCPU-sec/month$0.00002400/vCPU-sec
Memory (invocation)180k GB-sec/month$0.00000250/GB-sec
Min instances (idle)0CPU + memory billed always-on

Cloud SQL

Cost = instance tier (per hour) + storage per GB/month + backup storage + network
Tier$/hour (approx)
db-f1-micro~$0.013
db-n1-standard-2~$0.193
db-n1-standard-4~$0.386

HA (regional) doubles the instance cost (standby replica always running).

Cost Control Commands

# Set a budget alert
gcloud billing budgets create \
  --billing-account=BILLING_ACCOUNT_ID \
  --display-name="Monthly budget" \
  --budget-amount=100 \
  --threshold-rule=percent=0.8,basis=current-spend \
  --threshold-rule=percent=1.0,basis=current-spend \
  --notifications-rule-pubsub-topic=projects/my-project/topics/budget-alerts

# List billing accounts
gcloud billing accounts list

# Get billing account for a project
gcloud billing projects describe my-project

# Export billing data to BigQuery (set up via Console)
# → Billing > Billing export > BigQuery export

Cost Optimization Tips

TipImpact
Use Spot/Preemptible VMs for batch workloadsUp to 91% savings
Enable Committed Use Discounts for stable workloadsUp to 57%
Set Cloud Run --min-instances=0 for non-prodEliminate idle cost
Use Nearline/Coldline/Archive for infrequent data2–16x cheaper storage
Set object lifecycle policies to auto-transition storage classesAutomatic savings
Partition BigQuery tables — always filter on partition columnReduce bytes scanned
Use Cloud Monitoring budget alertsCatch runaway spend early
Delete idle Compute Engine snapshots, disks, and static IPsStop paying for orphaned resources
Check Recommender for rightsizing suggestionsgcloud recommender insights list

Recommender (Rightsizing)

# List VM rightsizing recommendations
gcloud recommender insights list \
  --recommender=google.compute.instance.MachineTypeRecommender \
  --location=us-central1-a \
  --project=my-project

# List idle resource recommendations
gcloud recommender insights list \
  --recommender=google.compute.instance.IdleResourceRecommender \
  --location=us-central1-a \
  --project=my-project

Billing Export & Analysis

-- Query billing export in BigQuery
SELECT
  service.description AS service,
  SUM(cost) AS total_cost,
  SUM(credits.amount) AS total_credits
FROM `my-project.billing_dataset.gcp_billing_export_v1_XXXXXX_XXXXXX_XXXXXX`
WHERE DATE(_PARTITIONTIME) >= DATE_SUB(CURRENT_DATE(), INTERVAL 30 DAY)
GROUP BY 1
ORDER BY 2 DESC
LIMIT 20;