Cost Control

Budgets and Alerts

Example

Get an email at 50%, 90% and 100% of a monthly budget:

gcloud billing budgets create \
  --billing-account=0X0X0X-0X0X0X-0X0X0X \
  --display-name="shop-dev monthly" \
  --budget-amount=5000INR \
  --threshold-rule=percent=0.5 --threshold-rule=percent=0.9 --threshold-rule=percent=1.0

Example output

Created budget [billingAccounts/0X0X0X-0X0X0X-0X0X0X/budgets/1a2b3c4d-...].

Note: A budget only alerts; it does not stop spending. Automate a response (e.g. Pub/Sub notification → function) if you need a hard stop for a sandbox.

Cost Optimisation Checklist

  1. Delete or stop idle resources: unused VMs, disks, IPs, dev databases.
  2. Prefer serverless (Cloud Run, Firestore) for spiky or low traffic: scale to zero.
  3. Right-size VMs and databases using the Recommender suggestions.
  4. Use committed use discounts for steady workloads and Spot VMs for batch.
  5. Apply lifecycle rules to move old objects to colder storage classes.
  6. Export billing data to BigQuery and label resources (team, env) to see who spends what.
  7. Watch network egress: serving users from the same region and using Cloud CDN reduces it.