Skip to content

Cost Management Guide

Overview

How to monitor and investigate Azure and AWS spend, understand what drives costs, respond to budget alerts, and keep cloud costs under control. ops-automation runs weekly cost reports — this guide explains how to read them and what to do when something spikes.


Azure Cost Monitoring

Azure Cost Analysis (Portal)

Azure Portal → Cost Management + Billing → Cost analysis

Switch the subscription scope at the top to see costs per subscription. Key views:

ViewHow to Use
Accumulated costMonth-to-date vs budget. Switch to daily granularity to see which day costs spiked.
Cost by resourceSort by cost descending to find the top spenders in a subscription
Cost by serviceWhich Azure service category is driving cost (Compute, Storage, Networking, Monitor)

Filter by subscription — check each of the six PROD subscriptions separately: Production, Logging, Identity, Firewall, Development, Main.

The Logging subscription is often the highest due to Log Analytics ingestion. The Production subscription has VM compute costs that vary with VM uptime.

Log Analytics Ingestion Cost

The biggest Azure cost lever. Log Analytics charges per GB ingested.

bash
# Check current month ingestion by table
az monitor log-analytics query --workspace 5d76d1f2 \
  --analytics-query "Usage | where TimeGenerated > startofmonth(now()) | where IsBillable == true | summarize GB = sum(Quantity)/1000 by DataType | sort by GB desc" \
  --output table

If ingestion is spiking, find the table growing fastest and trace it to the agent or diagnostic setting sending the data. Common culprits:

  • CommonSecurityLog — firewall logs; reduce Palo Alto log verbosity if needed
  • SecurityEvent — Windows event logs; check if a DC started logging excessively
  • ContainerLog — Container Apps; check for a noisy agent crashing in a loop

Hard cap on LAW ingestion is never set — inappropriate in a HIPAA environment. Use threshold alerts instead (see Budget Alerts below).

Azure Budgets and Alerts

Each subscription has a budget configured in Azure Cost Management. Alerts fire at 80% and 100% of the monthly budget.

To view or update budgets: Azure Portal → Cost Management + Billing → Budgets (switch subscription scope)

Budget alert emails go to the IT admin email. If an alert fires:

  1. Go to Cost Analysis for the subscription
  2. Find which resource or service caused the spike
  3. Determine if it's expected (new deployment, DR test) or unexpected (runaway process)

Common Azure Cost Spikes

SymptomLikely CauseFix
Compute spike mid-monthVM left running that should be stoppedDeallocate the VM
Storage spikeLog archive growing, large blob uploadCheck archive storage; adjust retention if over-retaining
Networking spikeData transfer out of Azure (egress)Check what's sending large volumes outbound
Monitor spikeDiagnostic settings sending too much to LAWReduce log verbosity or filter at the diagnostic setting
Container Apps spikeRevision consuming too many replicasCheck Container App scaling rules

AWS Cost Monitoring

AWS Cost Explorer

bash
# Current month spend by service across all accounts
aws ce get-cost-and-usage \
  --profile main \
  --time-period Start=$(date +%Y-%m-01),End=$(date +%Y-%m-%d) \
  --granularity MONTHLY \
  --metrics BlendedCost \
  --group-by Type=DIMENSION,Key=SERVICE \
  --output table

Or in the AWS console: Management account → Cost Explorer → by service.

The Management account (206820231356) has consolidated billing — all org account costs roll up here. Use Cost Explorer from the management account to see the full picture.

Per-Account Cost Breakdown

bash
# Spend by linked account this month
aws ce get-cost-and-usage \
  --profile main \
  --time-period Start=$(date +%Y-%m-01),End=$(date +%Y-%m-%d) \
  --granularity MONTHLY \
  --metrics BlendedCost \
  --group-by Type=DIMENSION,Key=LINKED_ACCOUNT \
  --output table

Most AWS cost is in the Production account (807267566999) (EC2 DR instances) and Backup account (863609217450) (S3 + Glacier storage for Veeam).

AWS Budgets

Budget alerts are configured per account in the management account: AWS Console → Management account → Billing → Budgets

Alerts fire at 80% and 100% thresholds and go to IT admin email.

Common AWS Cost Spikes

SymptomLikely CauseFix
EC2 spikeDR instances left running after a testStop instances in Production account
S3/Glacier spikeVeeam backup growthCheck backup retention policy in Veeam
Data transfer spikeLarge restore from Glacier or cross-region transferCheck Veeam restore jobs; Glacier Expedited retrieval is expensive
NAT Gateway spikeHigh outbound traffic from DR VPCCheck what's generating traffic in the DR environment

Glacier Retrieval Costs

Retrieving from S3 Glacier has tiered pricing:

  • Expedited (1–5 min): ~$0.03/GB + $0.01/request — use only in real DR
  • Standard (3–5h): ~$0.01/GB — use for planned restores and testing
  • Bulk (5–12h): ~$0.0025/GB — use for large archive exports

Always use Standard or Bulk for non-urgent restores. Expedited during a real DR event is acceptable.


ops-automation Cost Reports

ops-automation runs weekly cost reports that email a summary to IT admin. When the report arrives:

  1. Check the week-over-week delta — a >20% increase without a known cause is worth investigating
  2. The email breaks down top 5 cost drivers per cloud
  3. If something looks wrong, use Cost Explorer / Cost Analysis to drill in

If the cost report email stops arriving: check ops-automation GitHub Actions for the weekly-cost-report.yml workflow. A failing run means the report isn't generating.


Cost Optimization Opportunities

Items worth reviewing quarterly:

ItemHow to CheckAction
Stopped (not deallocated) Azure VMsAzure Portal → VMs → Power stateDeallocate stopped VMs — stopped VMs still charge for compute
Unused public IPsAzure → Public IP addresses → dissociatedDelete unattached public IPs
Old Azure snapshotsAzure → Snapshots → sort by dateDelete snapshots >90 days unless needed for compliance
S3 buckets missing lifecycle rulesaws s3api get-bucket-lifecycle-configuration --bucket <name>Add lifecycle rules to transition old objects to Glacier
Orphaned EBS volumesaws ec2 describe-volumes --filters Name=status,Values=availableDelete unattached volumes
Log Analytics over-retentionLAW → Usage and estimated costs → Data retentionCirius standard is 90 days hot + 6-year archive via export; don't pay for hot retention beyond 90 days


Document History

DateChangeAuthor
May 2026Initial draft — Azure Cost Analysis, LAW ingestion monitoring, AWS Cost Explorer, budget alerts, common spikes, ops-automation reports, optimization checklist.Rory

Internal use only — Cirius Group