FinOps / Guide 2

Measure usage before you pay

What to measure (CPU, memory, disk, network), for how long, and where each cloud shows it.

You can't right-size, schedule or commit sensibly without knowing how resources are actually used. Guessing usually leads to oversized VMs that stay oversized. This guide covers what to measure, over what period, and the built-in tools in each cloud that do most of the work for you.

What to measure

MetricWhat it tells youWatch out for
CPU: average and peak (P95)Whether the VM is too big, about right, or too smallA low average with short, high peaks. Size for the peak that matters, not the average.
MemoryWhether a smaller size will still fit the working setNot collected by default on any of the three clouds. Install the agent first (below).
Disk IOPS and throughputWhether a cheaper disk type or smaller VM will keep upSmaller VM sizes also have lower disk and network limits.
NetworkIdle servers (almost no traffic) and data transfer costsTraffic leaving the cloud or crossing regions costs money; inside a zone it is usually free.
Hours runningCandidates for power schedulesDevelopment and test that runs 24/7 but is used 50 hours a week.

Collect memory, not just CPU

All three clouds show CPU out of the box, but memory needs an agent inside the VM. Without it, rightsizing tools either ignore memory or play it safe.

AzureAWSGoogle Cloud
AgentAzure Monitor Agent with VM insightsCloudWatch agentOps Agent
Used by the rightsizing toolAzure Advisor (memory is used for resize recommendations)Compute Optimizer (memory only when the agent is installed)Recommender (memory when the Ops Agent is installed)

How long to measure

Two weeks is the minimum; a full month is better, so the data includes month-end processing, patch weekends and any monthly reports. For workloads with quarterly peaks (finance close, school terms, seasonal sales) look back further or size for the known peak.

ToolLookback
Azure AdvisorConfigurable: 7, 14, 21, 30, 60 or 90 days
AWS Compute Optimizer14 days by default; 32 days at no extra cost; 93 days with the paid enhanced infrastructure metrics
Google Cloud RecommenderBased on the last 8 days of usage for machine type recommendations

Let the built-in tools do the first pass

Each cloud already analyses your usage and suggests changes. Start there before building anything yourself.

AzureAWSGoogle Cloud
Rightsizing and idle resourcesAzure Advisor (Cost)AWS Compute Optimizer, Cost Optimization HubRecommender (Active Assist): machine type and idle VM recommendations
Spend by service, team or tagCost Management: Cost analysisCost ExplorerCloud Billing reports
Commitment recommendationsReservation and savings plan recommendations in AdvisorSavings Plans and RI recommendations in Cost ExplorerCUD recommendations and CUD analysis in Cloud Billing

Pull the same data from PowerShell when you want to review it in bulk:

# Azure: Advisor cost recommendations, and 30 days of peak CPU for one VM
Get-AzAdvisorRecommendation -Category Cost |
    Select-Object ImpactedValue, @{n='Problem';e={$_.ShortDescriptionProblem}}
$vm = Get-AzVM -ResourceGroupName 'rg-notes-test' -Name 'vm-notes-test-01'
Get-AzMetric -ResourceId $vm.Id -MetricName 'Percentage CPU' -StartTime (Get-Date).AddDays(-30) `
    -TimeGrain 01:00:00 -AggregationType Maximum
# AWS: Compute Optimizer findings, and 14 days of hourly peak CPU for one instance
Get-COEC2InstanceRecommendation -Region us-east-1 |
    Select-Object -ExpandProperty InstanceRecommendations |
    Select-Object InstanceName, CurrentInstanceType, Finding
Get-CWMetricStatistic -Namespace 'AWS/EC2' -MetricName 'CPUUtilization' `
    -Dimension @{ Name = 'InstanceId'; Value = 'i-0123456789abcdef0' } `
    -UtcStartTime (Get-Date).ToUniversalTime().AddDays(-14) -UtcEndTime (Get-Date).ToUniversalTime() `
    -Period 3600 -Statistic Maximum
# Google Cloud: machine type and idle VM recommendations for one zone
gcloud recommender recommendations list --project=prj-notes-test --location=us-east1-b `
    --recommender=google.compute.instance.MachineTypeRecommender
gcloud recommender recommendations list --project=prj-notes-test --location=us-east1-b `
    --recommender=google.compute.instance.IdleResourceRecommender

Tag what you measure

Usage data is only useful when you know who to ask. Before a review, make sure resources carry at least an owner, an environment (prod, dev, test) and a cost centre. The untagged-resource reports find the gaps: Get-AzUntaggedResources.ps1, Get-AwsUntaggedResources.ps1 and Get-GcpUnlabeledResources.ps1.