← All cheatsheets

Cloud

Cloud Cost Management — tagging, budgets, and killing a spend spike

A FinOps field guide: make every dollar attributable with tags, catch overspend with budgets and anomaly detection, then trace a sudden bill jump from service to account to the one resource behind it — and verify the daily run-rate actually drops. AWS-first with GCP equivalents.

Docs-checkedfinopscostbudgetsrightsizingegress

Quick reference — reach for these first

Tag & allocateaws ce update-cost-allocation-tags-status --cost-allocation-tags-status TagKey=env,Status=ActiveActivate cost-allocation tags so every line is attributable to an owner. Un-tagged spend can't be governed.
Budget + alertaws budgets create-budget --account-id ACCOUNT_ID --budget file://budget.json --notifications-with-subscribers file://notify.jsonA monthly cap with an 80% actual + forecasted alert. Your floor against surprises.
Anomaly detectionaws ce create-anomaly-monitor --anomaly-monitor file://monitor.jsonML baseline per service; alerts on deviation the moment it appears, no threshold guessing.
Rightsizeaws ce get-rightsizing-recommendation --service AmazonEC2Find idle and oversized compute with estimated monthly savings per instance. The biggest recurring lever.
Storage lifecycleaws s3api put-bucket-lifecycle-configuration --bucket BUCKET --lifecycle-configuration file://lifecycle.jsonTransition cold objects to IA/Glacier and expire them. Cap never-expiring logs the same way.

Killing a 40% spend spike: service → account → resource → verify

Killing a cloud spend spikeSix-stage flow: detect the bill jump, group cost by service, then by account or project, isolate the resource, remediate it, and verify the daily run-rate drops. Below are the five standing cost levers.Investigating a 40% bill jumpDetect+40%, dailyBy servicewhich?By accountwhose?ResourceGPU · egress · EBSRemediatestop · tier · deleteVerifyrun-rate drops5 standing leverstag & allocate · budgets + alerts · anomaly detection · rightsizing · storage lifecycle

Text equivalent: A six-stage left-to-right flow for investigating a sudden bill jump. Stage 1 Detect: the bill is up 40 percent, seen in daily Cost Explorer. Stage 2 group by service to find which service. Stage 3 group by account or project to find whose. Stage 4 isolate the one resource, typically a GPU instance, cross-AZ or internet egress, an unattached EBS volume, or never-expiring logs. Stage 5 remediate by stopping, tiering, or deleting the root cause. Stage 6, highlighted, verify the daily run-rate drops the next day. Below, the five standing levers: tag and allocate, budgets plus alerts, anomaly detection, rightsizing, and storage lifecycle.

Common tasks

Task · Command · What to check

TaskCommandWhat to check
Activate cost-allocation tags so spend becomes attributableaws ce update-cost-allocation-tags-status --cost-allocation-tags-status TagKey=env,Status=Active TagKey=team,Status=Activeaws ce list-cost-allocation-tags --status Active shows env and team
Close an allocation gap — tag an untagged resourceaws ec2 create-tags --resources INSTANCE_ID --tags Key=env,Value=prod Key=team,Value=TEAMaws ec2 describe-tags --filters Name=resource-id,Values=INSTANCE_ID lists both tags
See where the money goes — group the month by serviceaws ce get-cost-and-usage --time-period Start=START_DATE,End=END_DATE --granularity MONTHLY --metrics UnblendedCost --group-by Type=DIMENSION,Key=SERVICEGroups sorted by Amount; top ~5 services ≈ 80% of the bill
Split cost by account/project to localize a spikeaws ce get-cost-and-usage --time-period START_DATE,End=END_DATE --granularity DAILY --metrics UnblendedCost --group-by Type=DIMENSION,Key=LINKED_ACCOUNTOne account's daily line shows the step-up; others are flat
Create a monthly budget with an 80% + forecast alertaws budgets create-budget --account-id ACCOUNT_ID --budget file://budget.json --notifications-with-subscribers file://notify.jsonaws budgets describe-budgets --account-id ACCOUNT_ID lists it with notifications
Turn on Cost Anomaly Detection for the accountaws ce create-anomaly-monitor --anomaly-monitor '{"MonitorName":"acct","MonitorType":"DIMENSIONAL","MonitorDimension":"SERVICE"}'aws ce get-anomaly-monitors returns the monitor; add a subscription with get-anomaly-subscriptions
Pull rightsizing recommendations for EC2aws ce get-rightsizing-recommendation --service AmazonEC2RightsizingRecommendations[] lists Modify/Terminate targets + EstimatedMonthlySavings
Find idle spend — unattached EBS volumesaws ec2 describe-volumes --filters Name=status,Values=available --query "Volumes[].{id:VolumeId,GiB:Size}"List is empty, or you have a confirmed kill list
[DESTRUCTIVE] Snapshot then delete a confirmed-unused volumeaws ec2 create-snapshot --volume-id VOLUME_ID && aws ec2 delete-volume --volume-id VOLUME_IDaws ec2 describe-volumes --volume-ids VOLUME_ID returns InvalidVolume.NotFound
Tier cold storage — add an S3 lifecycle ruleaws s3api put-bucket-lifecycle-configuration --bucket BUCKET --lifecycle-configuration file://lifecycle.jsonaws s3api get-bucket-lifecycle-configuration --bucket BUCKET echoes the transitions
Cap never-expiring CloudWatch log retentionaws logs put-retention-policy --log-group-name LOG_GROUP --retention-in-days 30aws logs describe-log-groups --log-group-name-prefix LOG_GROUP shows retentionInDays=30
Catch idle egress — list unassociated Elastic IPsaws ec2 describe-addresses --query "Addresses[?AssociationId==null].PublicIp"Empty list; any returned EIP bills hourly while unattached
(GCP) Create a billing budget with a 90% threshold alertgcloud billing budgets create --billing-account=BILLING_ACCOUNT_ID --display-name="monthly" --budget-amount=1000USD --threshold-rule=percent=0.9gcloud billing budgets list --billing-account=BILLING_ACCOUNT_ID shows the budget

A bill jumps 40% overnight — trace it to a forgotten GPU box

AWS

1
Confirm the jump is real and sustained — pull daily cost by service
aws ce get-cost-and-usage --time-period Start=2026-11-01,End=2026-11-14 --granularity DAILY --metrics UnblendedCost --group-by Type=DIMENSION,Key=SERVICE
# Amazon EC2 steps from ~$180/day to ~$430/day starting Nov 09
2
Localize it — which account/project carries the step-up
aws ce get-cost-and-usage --time-period Start=2026-11-08,End=2026-11-14 --granularity DAILY --metrics UnblendedCost --group-by Type=DIMENSION,Key=LINKED_ACCOUNT
# Account 2222 (ml-sandbox) owns the entire +$250/day
3
Find the resource — list running instances by type in that account
aws ec2 describe-instances --filters Name=instance-state-name,Values=running --query "Reservations[].Instances[].{id:InstanceId,type:InstanceType,up:LaunchTime}"
# one p3.2xlarge (GPU) launched Nov 09, untagged
4
Prove it's idle before touching it — check utilization
aws cloudwatch get-metric-statistics --namespace AWS/EC2 --metric-name CPUUtilization --dimensions Name=InstanceId,Value=INSTANCE_ID --start-time 2026-11-09T00:00:00Z --end-time 2026-11-14T00:00:00Z --period 86400 --statistics Average
# Average CPU 0.4% across 5 days — abandoned
5
[DESTRUCTIVE] Stop it (reversible) and tag the owner; terminate only once confirmed
aws ec2 stop-instances --instance-ids INSTANCE_ID
# StoppingInstances: pending — the GPU hourly charge stops
6
Verify the run-rate actually drops the next day
aws ce get-cost-and-usage --time-period Start=2026-11-14,End=2026-11-16 --granularity DAILY --metrics UnblendedCost --group-by Type=DIMENSION,Key=SERVICE
# EC2 back to ~$180/day — the +$250/day is gone

Troubleshooting — symptom → first check → next check

SymptomFirst checkEstablishesNext check
20%+ of spend lands in an untagged / 'No tag key' bucket and can't be charged backaws ce get-cost-and-usage ... --group-by Type=TAG,Key=env and read the untagged groupHow much spend is un-attributable and which services carry itEnforce tags with an SCP / Tag Policy, backfill tags on existing resources; note activated cost-allocation tags only apply going forward
Budget blew past 100% but no alert ever arrivedaws budgets describe-notifications-for-budget --account-id ACCOUNT_ID --budget-name NAMEWhether a notification + confirmed subscriber exists and the threshold/comparison is correctBudgets refresh ~8–12h behind and fire once per threshold crossing; add a FORECASTED notification and confirm the SNS/email subscription
Spike with no new instances — cost is in 'Data Transfer' or 'Requests'aws ce get-cost-and-usage ... --group-by Type=DIMENSION,Key=USAGE_TYPE (look for DataTransfer-Out, NatGateway-Bytes, Requests)Whether it's internet egress, cross-AZ, NAT data processing, or raw API/request volumeAdd VPC gateway/interface endpoints so S3/ECR skip the NAT, keep traffic same-AZ, put CloudFront/caching in front; NAT charges per-GB processed on top of egress
A rightsizing downsize dropped an instance and p99 latency spikedCloudWatch CPU/memory + p99 on the smaller size vs the baseline windowWhether the new size is genuinely starved (CPU credits, memory, network) or the regression is unrelatedRoll back to the prior size or a different family; size to sustained p95, not the average; reserve burstable (t-family) for spiky low-baseline loads only
Reserved Instance / Savings Plan / CUD coverage is low or commitments sit unusedaws ce get-reservation-coverage and aws ce get-savings-plans-utilizationWhether you're under-covered (paying on-demand) or over-committed (paying for idle reservations)Commit only to the steady-state baseline; prefer flexible Compute Savings Plans over zonal RIs; let utilization settle before buying more
The anomaly detector stayed silent through a real spikeaws ce get-anomaly-monitors and get-anomaly-subscriptions — confirm the monitor dimension and a subscriberWhether a monitor covers that service and a subscription threshold sits below the spike sizeLower the subscription threshold (absolute $ or % impact), add a SERVICE-dimension monitor; remember it needs ~10 days of history to learn a baseline

References

Examples are AWS-first (Cost Explorer `ce`, Budgets, Cost Anomaly Detection) with GCP noted where it differs. CAPS tokens (ACCOUNT_ID, INSTANCE_ID, VOLUME_ID, BUCKET, LOG_GROUP, BILLING_ACCOUNT_ID, START_DATE/END_DATE as YYYY-MM-DD) are placeholders. Cost Explorer and Budgets data lag ~8–24h and the anomaly detector needs ~10 days of history to model a baseline — so verify a fix by the next day's run-rate, not instantly.