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