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)
| Service | Free allowance per month |
|---|---|
| Compute Engine | 1 e2-micro VM in us-west1, us-central1, or us-east1 |
| Cloud Storage | 5 GB standard storage (US regions only) + 1 GB network egress |
| BigQuery | 1 TB query processing + 10 GB storage |
| Cloud Run | 2 million requests, 360,000 GB-sec memory, 180,000 vCPU-sec |
| Cloud Functions | 2 million invocations, 400,000 GB-sec, 200,000 GHz-sec |
| Pub/Sub | 10 GB messages |
| Cloud Firestore | 1 GB storage, 50k reads, 20k writes, 20k deletes per day |
| Cloud Build | 120 build-minutes per day |
| Artifact Registry | 0.5 GB storage |
| Secret Manager | 6 active secret versions, 10k access operations |
| Cloud Logging | First 50 GB log ingestion |
| Cloud Monitoring | 150 MB metric ingestion |
| Cloud Shell | Free interactive terminal (ephemeral VM) |
| Maps Platform | $200/month credit (covers most small apps) |
The free-tier Compute Engine
e2-microdoes 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 type | How | Savings |
|---|---|---|
| Sustained use | Auto-applied for >25% of month | Up to 30% |
| Committed use (1yr) | Pre-pay for 1 year | Up to 37% |
| Committed use (3yr) | Pre-pay for 3 years | Up to 57% |
| Spot VMs | Preemptible, available capacity | Up to 91% |
| Custom machine types | Right-size vCPU/RAM | Avoid over-provisioning |
Cloud Storage
| Class | Storage per GB/month | Retrieval per GB | Min duration |
|---|---|---|---|
| Standard | $0.020 | — | — |
| Nearline | $0.010 | $0.01 | 30 days |
| Coldline | $0.004 | $0.02 | 90 days |
| Archive | $0.0012 | $0.05 | 365 days |
Network egress charges apply (within-region is free; cross-region varies; internet egress from $0.08/GB).
BigQuery
| Item | Cost |
|---|---|
| On-demand queries | $6.25 per TB scanned |
| First 1 TB/month | Free |
| 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
| Item | Free tier | Price above free |
|---|---|---|
| Requests | 2M/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) | 0 | CPU + 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
| Tip | Impact |
|---|---|
| Use Spot/Preemptible VMs for batch workloads | Up to 91% savings |
| Enable Committed Use Discounts for stable workloads | Up to 57% |
Set Cloud Run --min-instances=0 for non-prod | Eliminate idle cost |
| Use Nearline/Coldline/Archive for infrequent data | 2–16x cheaper storage |
| Set object lifecycle policies to auto-transition storage classes | Automatic savings |
| Partition BigQuery tables — always filter on partition column | Reduce bytes scanned |
| Use Cloud Monitoring budget alerts | Catch runaway spend early |
| Delete idle Compute Engine snapshots, disks, and static IPs | Stop paying for orphaned resources |
| Check Recommender for rightsizing suggestions | gcloud 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;