FinOps foundations: Cost Explorer, budgets per account and anomaly alerts
Make cloud spend visible and owned: read Cost Explorer by account, service and tag, set a budget and an anomaly monitor per account, group costs with cost categories, and report unit costs with a small C# tool.
Assumes: .NET 10 LTS · AWS SDK for .NET v4 (AWSSDK.CostExplorer 4.x) · AWS CLI v2 · CDK v2 (Amazon.CDK.Lib 2.277.0) · Terraform AWS provider v6 · Region us-east-1. Verified against official sources on 2026-11-18.
Learning objectives
By the end of this lesson you can:
- Explain FinOps in plain language and describe its three loops: inform, optimise and operate.
- Answer "where did the money go?" in Cost Explorer by account, service, Region and tag, and know which cost metric to use.
- Create a budget per account with actual and forecast alerts, and explain why a budget alerts but does not stop spending.
- Create Cost Anomaly Detection monitors and subscriptions, and describe how soon they can fire.
- Group costs with cost categories for showback, and calculate a unit cost such as cost per 1,000 payments.
- Query Cost Explorer from C# to build a month-to-date report by cost centre.
Prerequisites
- Tagging strategy and tag policies. Cost allocation tags are the key to the "by team" reports in this lesson.
- Pricing models and Free tier and billing for On-Demand, Savings Plans and the billing basics.
- Cost monitoring for observability, which applies budgets and anomaly detection to CloudWatch only. This lesson widens the lens to the whole organisation.
- Tools: AWS CLI v2 with the
learn-sandboxprofile. For organisation-wide views you need the management account (or a member account with billing access delegated to it).
Why this matters in banking
On the 3rd of the month the finance partner opens a message: "AWS was 40 percent over forecast. Who approved this?" Nobody knows. After a day of searching, the cause turns out to be a data-science experiment that left a large cluster running over the weekend, plus a verbose log level nobody turned back. Both were cheap to prevent: a daily anomaly alert would have caught the cluster on Saturday, and a per-account budget with a forecast alert would have warned the account owner mid-month.
In banking the problem has a second layer. Cloud spend is now a line in the board's cost report, charged back to business lines, and subject to year-end budgets. Engineers who can say "the Cards platform costs 0.7 pence per transaction and is flat despite 20 percent growth" are doing something valuable. Engineers who cannot explain a bill are treated as a risk. FinOps is simply the habit of making cost a normal engineering metric, like latency.
The idea in plain language
FinOps (financial operations for the cloud) is a way of working in which engineering, finance and the business share responsibility for cloud cost. The FinOps Foundation describes three repeating phases. The names below are a plain paraphrase:
- Inform. Make cost visible and attributable: who spent what, on which service, for which product. Tags, accounts and reports live here.
- Optimise. Find and remove waste, and buy capacity more cheaply: rightsizing, deleting idle things, Savings Plans. That is the next lesson.
- Operate. Make it routine: budgets, alerts, reviews, owners, targets. Operate is where most organisations fail, because it requires people and not only tools.
Cloud cost is different from data-centre cost in three ways that matter. It is variable (a mistake costs money immediately), granular (billed per second, request or gigabyte) and decentralised (any engineer with permission can spend). Those three facts explain why budgets, alerts and ownership are needed.
Analogy: a data centre is a salary: you pay a fixed amount whatever you do. The cloud is a taxi meter: it runs whenever the engine is on, whoever is driving. FinOps puts a visible meter in every cab, tells the driver what the fare is, and sets a rule for when to call dispatch.
The vocabulary you need
| Term | Meaning |
|---|---|
| Management account (payer) | The account that receives the consolidated bill for the organisation |
| Linked (member) account | A workload account whose cost rolls up to the payer |
| Unblended cost | The price as charged for the usage in that account at the time, before discount sharing |
| Amortized cost | Upfront and recurring commitment fees spread across the period of the commitment |
| Net unblended / net amortized | The same figures after applicable discounts are applied |
| Showback | Telling each team what it spent, without moving money |
| Chargeback | Actually billing the team's budget internally |
| Unit cost | Cost divided by a business measure, such as cost per 1,000 payments |
| Cost category | A named grouping of costs defined by rules (account, tag, service), usable in reports and budgets |
The metric you pick changes the story. A one-year Savings Plan paid upfront appears as a large lump on the day it is bought under unblended cost, and as an even spread under amortized cost. For team-level showback, amortized is usually fairer. Finance will have its own view, so agree the metric before you publish numbers. ⚠ VERIFY exactly how each cost type treats discounts and credits in your account's data.
What problem the AWS service solves
| Tool | What it does | Honest limits |
|---|---|---|
| Cost Explorer | Interactive and API reports of cost and usage, grouped by service, account, Region, usage type, tag or cost category; forecasts | Data lags up to about 24 hours; history length and granularity options are limited (hourly and resource-level are optional extras ⚠ VERIFY); API requests are charged per call ⚠ VERIFY |
| AWS Budgets | Cost, usage, Savings Plans and RI budgets, with actual and forecast alerts to email, SNS or chat, and optional budget actions | Updated up to three times a day; alerts, not hard stops; there is a lag between spend and notification |
| Cost Anomaly Detection | Machine-learning monitors that flag unusual spend, with root-cause hints by service, account, Region and usage type | Runs about three times a day on Cost Explorer data, so detection can take up to about 24 hours; a new monitor takes about 24 hours to start; a new service needs about 10 days of history; Marketplace charges are mostly not covered |
| Cost allocation tags | Make your tags usable in cost reports | Activated by hand in the management account; apply going forward |
| Cost categories | Rule-based groups such as "Cards business line = accounts A, B + anything tagged CostCenter CC-5100" | Rules are evaluated in order; costs not matched fall into an "uncategorised" bucket you should watch |
| Billing and Cost Management data exports | Detailed billing data to S3 | Covered in the next lesson |
Budgets and anomaly detection overlap but differ. A budget says "I expect to spend X; tell me if I will not". An anomaly monitor says "this is unusual compared with the pattern". A steady 30 percent overspend that started months ago will not trip an anomaly monitor but will trip a budget. A sudden spike that is still within budget will trip the monitor but not the budget. You need both.
A budget does not stop spending
Budget alerts are notifications. A cost budget will not switch anything off. Budget actions can attach an IAM policy or SCP, or stop EC2 and RDS instances, when a threshold is crossed, but they act with delay and can break production. Use them in sandbox and development accounts, and for production send alerts to people instead. A bank should never have a billing threshold able to stop a payments service without a human decision.
Microsoft / Azure comparison
| You know (Microsoft/Azure) | AWS equivalent | What's different |
|---|---|---|
| Azure Cost Management + Billing | Billing and Cost Management console | Features are split across Cost Explorer, Budgets, Anomaly Detection, Cost categories and data exports |
| Cost analysis by subscription or management group | Cost Explorer grouped by linked account | An AWS account is the main boundary, and OUs are not a cost dimension (use cost categories or account lists) |
| Azure budgets with action groups | AWS Budgets with SNS, email, chat and budget actions | Similar. Neither stops resources by default |
| Cost anomaly alerts (preview/GA) | Cost Anomaly Detection | Separate monitors you create; root-cause hints by service, account, Region and usage type |
| Tags with inheritance from resource group | Cost allocation tags, tag policies, cost categories | No resource-group inheritance; apply tags in code |
| Azure Advisor cost recommendations | Cost Optimization Hub, Compute Optimizer, Trusted Advisor | Covered in the commitments lesson |
| EA / MCA invoice hierarchy | Consolidated billing in AWS Organizations | The payer account receives one bill with a per-account breakdown |
| Power BI cost reports | Cost Explorer, QuickSight, Athena on exports | See the next lesson |
Architecture
Security-boundary view: billing data is visible only to people with billing permissions in the management account. Member-account owners can by default create their own budgets, but only see their own account's data. The SNS topic that carries alerts should be encrypted and restricted so that only the Budgets and Cost Anomaly Detection services can publish to it.
Step-by-step implementation
Turn the data on
In the management account, make sure Cost Explorer is enabled and that IAM access to billing is allowed for the roles who need it (the account setting IAM user and role access to Billing information). Data can take up to 24 hours to appear after you first enable it.
Look at the bill the right way
Open Cost Explorer. Group by Linked account, then Service, then by a tag (once CostCenter is activated). Use Amortized cost for commitment-heavy accounts and keep the metric the same every time you compare months.
Create one budget per account
Create a monthly cost budget for each member account, sized from the last three months plus a margin, with an actual 80 percent alert and a forecast 100 percent alert. Send both to an SNS topic and to the account owner's team address.
Create anomaly monitors
Create an AWS services monitor (the default and widest), a linked accounts monitor for important accounts, and a cost allocation tag monitor for CostCenter. Subscribe the FinOps team with a daily summary and the account owners with an immediate alert above a dollar threshold.
Add cost categories
Define a cost category called BusinessLine that maps accounts and tags to Retail, Cards, Payments and Shared. Use it in Cost Explorer and budgets so everyone shares one definition.
Choose unit metrics
Pick one business measure per product (payments processed, active accounts, API calls) and divide cost by it each month. Plot the trend. A rising total with a falling unit cost is healthy growth.
Set a monthly review
A 30-minute review per business line: top three cost movers, anomalies seen, actions taken, forecast. Assign every action an owner and a date.
AWS Console instructions
- Cost Explorer: Console → Billing and Cost Management → Cost Explorer. Set the time range, choose Group by: Linked account (or Tag or Cost category), and use Filters for Service or Region. Change the Advanced options to select cost type (for example Amortized costs).
- Budgets: Billing and Cost Management → Budgets → Create budget → Cost budget. Choose the monthly period, a fixed amount, and under Budget scope filter by Linked account. In Alert 1 set Actual, 80 percent; in Alert 2 set Forecasted, 100 percent. Add an SNS topic and email recipients.
- Anomaly detection: Billing and Cost Management → Cost Anomaly Detection → Cost monitors → Create monitor. Choose a monitor type (AWS services, Linked account, Cost category or Cost allocation tag). Then Alert subscriptions → Create: choose the monitor, an alerting threshold (a dollar amount or percentage of impact), a frequency (individual, daily summary or weekly summary) and the recipient or SNS topic.
- Cost categories: Billing and Cost Management → Cost categories → Create cost category, add rules (for example
Linked account is one of ...orTag CostCenter is CC-5100), choose a default value for unmatched costs.
Console wording changes often. ⚠ VERIFY each path against the current console.
AWS CLI
# 1) Last month by linked account (management account). Costs are returned as strings.
aws ce get-cost-and-usage \
--time-period Start=2026-10-01,End=2026-11-01 \
--granularity MONTHLY --metrics AmortizedCost \
--group-by Type=DIMENSION,Key=LINKED_ACCOUNT \
--profile learn-mgmt --region us-east-1
# 2) Same period grouped by the CostCenter tag (needs the tag activated as a cost allocation tag).
aws ce get-cost-and-usage \
--time-period Start=2026-10-01,End=2026-11-01 \
--granularity MONTHLY --metrics AmortizedCost \
--group-by Type=TAG,Key=CostCenter \
--profile learn-mgmt --region us-east-1
# 3) Forecast total cost for the rest of the month.
aws ce get-cost-forecast \
--time-period Start=2026-11-19,End=2026-12-01 \
--metric UNBLENDED_COST --granularity MONTHLY \
--profile learn-mgmt --region us-east-1
# 4) Create a monthly budget for one member account (JSON files below).
aws budgets create-budget --account-id 111122223333 \
--budget file://budget-cards.json \
--notifications-with-subscribers file://notifications.json \
--profile learn-mgmt --region us-east-1
# 5) Create an anomaly monitor for AWS services and subscribe a daily summary.
aws ce create-anomaly-monitor \
--anomaly-monitor 'MonitorName=hl-services,MonitorType=DIMENSIONAL,MonitorDimension=SERVICE' \
--profile learn-mgmt --region us-east-1
aws ce create-anomaly-subscription --anomaly-subscription \
'SubscriptionName=hl-daily,Frequency=DAILY,MonitorArnList=[arn:aws:ce::111122223333:anomalymonitor/abcd],Subscribers=[{Address=finops@example.com,Type=EMAIL}],ThresholdExpression={Dimensions={Key=ANOMALY_TOTAL_IMPACT_ABSOLUTE,MatchOptions=[GREATER_THAN_OR_EQUAL],Values=[50]}}' \
--profile learn-mgmt --region us-east-1
# 4b) List anomalies found in the last 30 days.
aws ce get-anomalies --date-interval StartDate=2026-10-19,EndDate=2026-11-18 \
--profile learn-mgmt --region us-east-1
# 6) Create a cost category with rules from a JSON file.
aws ce create-cost-category-definition \
--name BusinessLine --rule-version CostCategoryExpression.v1 \
--default-value Shared --rules file://business-line-rules.json \
--profile learn-mgmt --region us-east-1The Cost Explorer API charges per request and is meant for tools, not for loops, so cache results. ⚠ VERIFY the current price.
{
"BudgetName": "hl-acct-cards-monthly",
"BudgetType": "COST",
"TimeUnit": "MONTHLY",
"BudgetLimit": { "Amount": "4000", "Unit": "USD" },
"CostFilters": { "LinkedAccount": ["111122223333"] }
}[
{
"Notification": {
"NotificationType": "ACTUAL",
"ComparisonOperator": "GREATER_THAN",
"Threshold": 80,
"ThresholdType": "PERCENTAGE"
},
"Subscribers": [{ "SubscriptionType": "EMAIL", "Address": "cards-platform@example.com" }]
},
{
"Notification": {
"NotificationType": "FORECASTED",
"ComparisonOperator": "GREATER_THAN",
"Threshold": 100,
"ThresholdType": "PERCENTAGE"
},
"Subscribers": [{ "SubscriptionType": "EMAIL", "Address": "cards-platform@example.com" }]
}
][
{
"Value": "Cards",
"Rule": { "Dimensions": { "Key": "LINKED_ACCOUNT", "Values": ["111122223333"] } }
},
{
"Value": "Payments",
"Rule": { "Tags": { "Key": "CostCenter", "Values": ["CC-5100"] } }
}
]Budget filter keys and rule syntax are checked by the service. ⚠ VERIFY the current JSON shapes with aws budgets create-budget help and aws ce create-cost-category-definition help, especially if you use the newer filter expression fields instead of CostFilters.
Infrastructure as Code
One budget per member account, created in a loop, plus an anomaly monitor and a daily subscription, all sending to one SNS topic. It is deployed in the management account. L1 constructs; property names follow CloudFormation. ⚠ VERIFY
using System.Collections.Generic;
using Amazon.CDK;
using Amazon.CDK.AWS.Budgets;
using Amazon.CDK.AWS.CE;
using Amazon.CDK.AWS.IAM;
using Amazon.CDK.AWS.SNS;
using Constructs;
namespace Harbourline.Governance.Infra;
public sealed class FinOpsFoundationsStack : Stack
{
public FinOpsFoundationsStack(
Construct scope,
string id,
IReadOnlyDictionary<string, (string AccountId, int MonthlyUsd)> accounts,
string finopsEmail,
IStackProps? props = null) : base(scope, id, props)
{
Amazon.CDK.Tags.Of(this).Add("Project", "cea-lab");
Amazon.CDK.Tags.Of(this).Add("Lab", "m15-l9");
Amazon.CDK.Tags.Of(this).Add("Environment", "learn");
var topic = new Topic(this, "FinOpsAlerts", new TopicProps { TopicName = "hl-finops-alerts" });
// Allow only the Budgets and Cost Anomaly Detection services to publish.
topic.AddToResourcePolicy(new PolicyStatement(new PolicyStatementProps
{
Sid = "AllowBillingServicesToPublish",
Effect = Effect.ALLOW,
Principals = new IPrincipal[]
{
new ServicePrincipal("budgets.amazonaws.com"),
new ServicePrincipal("costalerts.amazonaws.com"),
},
Actions = new[] { "sns:Publish" },
Resources = new[] { topic.TopicArn },
}));
// --- One monthly budget per account ---------------------------------------------------
foreach (var (name, (accountId, monthlyUsd)) in accounts)
{
new CfnBudget(this, $"Budget{name}", new CfnBudgetProps
{
Budget = new CfnBudget.BudgetDataProperty
{
BudgetName = $"hl-acct-{name.ToLowerInvariant()}-monthly",
BudgetType = "COST",
TimeUnit = "MONTHLY",
BudgetLimit = new CfnBudget.SpendProperty { Amount = monthlyUsd, Unit = "USD" },
CostFilters = new Dictionary<string, object>
{
["LinkedAccount"] = new[] { accountId },
},
},
NotificationsWithSubscribers = new[]
{
Notify("ACTUAL", 80, topic.TopicArn, finopsEmail),
Notify("FORECASTED", 100, topic.TopicArn, finopsEmail),
},
});
}
// --- Anomaly detection: all AWS services, daily summary, impact of 50 USD or more -----------
var monitor = new CfnAnomalyMonitor(this, "ServicesMonitor", new CfnAnomalyMonitorProps
{
MonitorName = "hl-services",
MonitorType = "DIMENSIONAL",
MonitorDimension = "SERVICE",
});
new CfnAnomalySubscription(this, "DailyAnomalies", new CfnAnomalySubscriptionProps
{
SubscriptionName = "hl-daily",
Frequency = "DAILY",
MonitorArnList = new[] { monitor.AttrMonitorArn },
Subscribers = new[]
{
new CfnAnomalySubscription.SubscriberProperty { Type = "EMAIL", Address = finopsEmail },
},
// ThresholdExpression is a JSON string in the L1 construct ⚠ VERIFY.
ThresholdExpression =
"{\"Dimensions\":{\"Key\":\"ANOMALY_TOTAL_IMPACT_ABSOLUTE\",\"MatchOptions\":[\"GREATER_THAN_OR_EQUAL\"],\"Values\":[\"50\"]}}",
});
}
private static CfnBudget.NotificationWithSubscribersProperty Notify(
string type, double threshold, string topicArn, string email) => new()
{
Notification = new CfnBudget.NotificationProperty
{
NotificationType = type,
ComparisonOperator = "GREATER_THAN",
Threshold = threshold,
ThresholdType = "PERCENTAGE",
},
Subscribers = new[]
{
new CfnBudget.SubscriberProperty { SubscriptionType = "SNS", Address = topicArn },
new CfnBudget.SubscriberProperty { SubscriptionType = "EMAIL", Address = email },
},
};
}Complete code
A C# month-to-date report by cost centre, with a forecast and a unit cost. It calls Cost Explorer once for tag-grouped cost, once for the total forecast, and prints a table. Cache the output or run it daily at most, because the API is charged per request.
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net10.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>
<ItemGroup>
<!-- Look up exact 4.x versions at https://api.nuget.org/v3-flatcontainer/<id>/index.json -->
<PackageReference Include="AWSSDK.CostExplorer" Version="4.*" />
</ItemGroup>
</Project>using System.Globalization;
using Amazon.CostExplorer;
using Amazon.CostExplorer.Model;
// Optional: pass a business volume (payments this month) to compute a unit cost.
long payments = args.Length > 0 && long.TryParse(args[0], out var p) ? p : 0;
var today = DateTime.UtcNow.Date;
var start = new DateTime(today.Year, today.Month, 1);
var end = today.AddDays(1); // End is exclusive, so include today
var monthEnd = start.AddMonths(1);
using var ce = new AmazonCostExplorerClient();
// ---- Month-to-date cost grouped by the CostCenter tag ---------------------------------------
var byCostCenter = new Dictionary<string, decimal>();
string? token = null;
do
{
var response = await ce.GetCostAndUsageAsync(new GetCostAndUsageRequest
{
TimePeriod = new DateInterval { Start = start.ToString("yyyy-MM-dd"), End = end.ToString("yyyy-MM-dd") },
Granularity = Granularity.MONTHLY,
Metrics = ["AmortizedCost"],
GroupBy = [new GroupDefinition { Type = GroupDefinitionType.TAG, Key = "CostCenter" }],
NextPageToken = token,
});
foreach (var period in response.ResultsByTime ?? [])
{
foreach (var group in period.Groups ?? [])
{
// Tag group keys look like "CostCenter$CC-4410"; an empty value is "CostCenter$".
var raw = group.Keys?.FirstOrDefault() ?? "CostCenter$";
var value = raw.Contains('$') ? raw[(raw.IndexOf('$') + 1)..] : raw;
if (value.Length == 0) value = "(untagged)";
var amount = decimal.Parse(group.Metrics["AmortizedCost"].Amount, CultureInfo.InvariantCulture);
byCostCenter[value] = byCostCenter.GetValueOrDefault(value) + amount;
}
}
token = string.IsNullOrEmpty(response.NextPageToken) ? null : response.NextPageToken;
}
while (token is not null);
decimal total = byCostCenter.Values.Sum();
Console.WriteLine($"Month to date {start:yyyy-MM-dd} to {today:yyyy-MM-dd} (amortized, USD)");
Console.WriteLine(new string('-', 54));
foreach (var (key, amount) in byCostCenter.OrderByDescending(kv => kv.Value))
{
var share = total == 0 ? 0 : amount / total * 100;
Console.WriteLine($"{key,-24} {amount,12:N2} {share,6:F1}%");
}
Console.WriteLine(new string('-', 54));
Console.WriteLine($"{"Total",-24} {total,12:N2}");
var untagged = byCostCenter.GetValueOrDefault("(untagged)");
Console.WriteLine($"Untagged share: {(total == 0 ? 0 : untagged / total * 100):F1}%");
// ---- Forecast for the rest of the month -----------------------------------------------------
if (today.AddDays(1) < monthEnd)
{
var forecast = await ce.GetCostForecastAsync(new GetCostForecastRequest
{
TimePeriod = new DateInterval
{
Start = today.AddDays(1).ToString("yyyy-MM-dd"),
End = monthEnd.ToString("yyyy-MM-dd"),
},
Metric = Metric.AMORTIZED_COST,
Granularity = Granularity.MONTHLY,
});
var remaining = decimal.Parse(forecast.Total.Amount, CultureInfo.InvariantCulture);
Console.WriteLine($"Forecast for the rest of the month: {remaining:N2} (month total about {total + remaining:N2})");
}
// ---- Unit cost -------------------------------------------------------------------------------
if (payments > 0)
{
Console.WriteLine($"Unit cost: {total / payments * 1000:N4} USD per 1,000 payments");
}Code explained line by line
paymentsis an optional command-line argument, because the business measure comes from your product analytics, not from AWS. The unit cost is the part that finance and product care about.Endin Cost Explorer'sDateIntervalis exclusive. To include today's partial data, the end is tomorrow. Today's figure is incomplete because billing data lags.Metrics = ["AmortizedCost"]chooses the metric. Use the same metric every month so numbers are comparable.GroupBywithGroupDefinitionType.TAGgroups by theCostCentertag. This only works after the tag is activated as a cost allocation tag in the management account.- Tag group keys are returned as
Key$Value. The code strips the prefix and renames the empty value to(untagged), which makes the biggest hygiene gap visible in the report. - Amounts are strings, so
decimal.Parsewith the invariant culture avoids a UK or EU locale reading1,234.56wrongly. Money stays indecimal. - The loop follows
NextPageToken. Results can be paged when there are many groups. GetCostForecastAsyncpredicts the rest of the month and the tool adds it to the month to date. Forecasts need enough history and are an estimate. They are not a promise.- Unit cost is total cost divided by volume, multiplied by 1,000. Always say which cost metric and which period.
Security considerations
⚠ Learning shortcut — not for production
The lab sends alerts to a personal email address and runs the report with your own administrator-level SSO session. In production, alerts go to a monitored shared channel and an on-call rota, the SNS topic is encrypted with a customer-managed key and restricted to the billing services, and the report runs as a dedicated read-only FinOps role limited to ce:Get* and budgets:View*. Budget actions that stop resources are not used in production without an explicit approval step.
- Billing data is sensitive. It reveals architecture, vendor relationships and growth. Limit Cost Explorer access, and avoid sending raw exports to personal accounts.
- Do not put account IDs or personal data in public repositories. Use placeholders in code samples (the ones here are fictional).
- Anomaly alerts can reveal an incident. A sudden cost spike in a data transfer line might mean exfiltration, and a spike in a compute line might mean a compromised credential used for crypto mining. Route anomaly alerts to security as well as FinOps for the accounts that hold sensitive data.
- Least privilege for tools. The C# report needs
ce:GetCostAndUsageandce:GetCostForecast. It does not need billing write access.
Banking use case
Harbourline sets one budget per account, plus an anomaly monitor for all services and a second by CostCenter. A new Cards feature launches and its non-production account triggers a daily-summary anomaly: a NAT gateway left in a busy subnet shows steady data processing charges. The owner fixes the routing the next morning. A month later, the monthly review shows the Payments platform at 0.62 USD per 1,000 payments against 0.71 the previous quarter, even though volume grew 18 percent. That unit-cost line goes into the technology risk report. The FinOps lead also notes that 11 percent of spend is "(untagged)" and sends a list to owners. The tagging lesson's controls then reduce it to under 3 percent in two cycles.
Common mistakes
- One big organisation budget only. It hides the account that is the problem. Budget per account or per business line.
- Only actual alerts. By the time actual spend crosses 100 percent the damage is done. Use forecast alerts.
- Believing a budget will stop the spend. It will not.
- Changing the cost metric between months. Unblended versus amortized flips the story for commitment-heavy accounts.
- Ignoring the lag. Cost Explorer, Budgets and anomaly detection all trail real usage by hours. They are not real-time. For fast detection of specific risks (a runaway log group) use CloudWatch alarms on usage metrics.
- Alert fatigue. A threshold of one dollar on daily anomalies teaches everyone to ignore them. Start with a meaningful absolute threshold and tune.
- No owner. Alerts to a distribution list nobody reads are decoration.
Troubleshooting
| Symptom | Likely cause | Fix |
|---|---|---|
| Cost Explorer says no data | Not enabled yet, or the account is new | Enable it and wait up to 24 hours |
Tag grouping shows only (untagged) | Tag not activated, or activated recently | Activate in the management account; wait; data applies from activation |
| Budget never alerts | Threshold above realistic spend, wrong filter, or notification confirmation pending | Check the filter, subscribers and the SNS subscription confirmation |
| Budget SNS notifications do not arrive | Topic policy does not allow budgets.amazonaws.com to publish | Add the policy statement shown in the IaC |
| Anomaly subscription never fires | Threshold too high, new monitor learning (about 24 hours), or new service with under 10 days of history | Lower the threshold, wait, check get-anomalies |
DataUnavailableException or empty forecast | Not enough history for a forecast | Wait for more data or use a longer window |
AccessDeniedException for billing | IAM access to billing is not activated, or the role lacks ce:* permissions | Activate IAM billing access in the management account; grant the read-only permissions |
| Costs differ between Cost Explorer and the invoice | Different cost metric, tax, support charges, timing or credits | Compare the same metric and period; check what is excluded |
Cost and cleanup
Cost: free for the learning steps. Cost Explorer's console is free. The API is charged per request ⚠ VERIFY, so run the report a handful of times. AWS Budgets lets you have a small number of budgets free, and charges for additional ones ⚠ VERIFY current allowance and price. Cost Anomaly Detection has no charge for the service ⚠ VERIFY. SNS email notifications cost nothing at this volume. Cost categories have no charge ⚠ VERIFY.
Teardown:
# Delete budgets created for the lab.
aws budgets delete-budget --account-id 111122223333 --budget-name hl-acct-cards-monthly \
--profile learn-mgmt --region us-east-1
# Delete the anomaly subscription and monitor (ARNs come from the list commands).
aws ce get-anomaly-subscriptions --profile learn-mgmt --region us-east-1
aws ce delete-anomaly-subscription --subscription-arn <subscription-arn> --profile learn-mgmt --region us-east-1
aws ce get-anomaly-monitors --profile learn-mgmt --region us-east-1
aws ce delete-anomaly-monitor --monitor-arn <monitor-arn> --profile learn-mgmt --region us-east-1
# Delete the cost category created in the lab.
aws ce list-cost-category-definitions --profile learn-mgmt --region us-east-1
aws ce delete-cost-category-definition --cost-category-arn <arn> --profile learn-mgmt --region us-east-1
# Delete the SNS topic.
aws sns delete-topic --topic-arn arn:aws:sns:us-east-1:111122223333:hl-finops-alerts --profile learn-mgmtKeep one budget and one anomaly monitor on your real learning account permanently. They cost almost nothing and protect you from surprise bills.
Exercises
- 🟢 Guided: in your sandbox account, create a 10 USD monthly budget with an 80 percent actual alert and a 100 percent forecast alert, and one AWS-services anomaly monitor with a daily email.
- 🟡 Challenge: deploy the CDK or Terraform stack with three fictional accounts. Add a fourth alert at 120 percent actual that goes to the engineering director's address.
- 🔴 Live problem: the finance partner says last month's bill was 40 percent above forecast, but no budget fired. Investigate with Cost Explorer: which dimension would you group by first, what could explain a miss by both budgets and anomaly detection, and what would you change?
Assignment
Create governance/finops/ in your portfolio repository containing the budgets and anomaly monitor as code, the report tool, and a one-page finops-operating-model.md: owners, review cadence, alert routing, thresholds and the single cost metric you chose.
Solutions
Use a cost budget with TimeUnit = MONTHLY, limit 10 USD, and two notifications: ACTUAL at 80 percent and FORECASTED at 100 percent. Create an anomaly monitor MonitorType = DIMENSIONAL, MonitorDimension = SERVICE, and a DAILY subscription to your email with a threshold of a small absolute impact. Confirm the SNS or email subscription. Budgets update up to about three times a day, so do not expect an immediate test. Why both alerts? The 80 percent actual tells you that you are close, and the 100 percent forecast tells you early that you will exceed it, which is usually days before the actual threshold would.
Add a third notification in the notification list with Threshold = 120, NotificationType = ACTUAL, and the director's address. Use a loop over the account dictionary so every account gets the same alert set. Keep thresholds in one list so changing a policy is one edit. In production, high-severity thresholds go to a paging system or chat channel, not only email.
Knowledge check
Answer: Nothing by default. Budgets send notifications. You can configure budget actions to apply an IAM policy or SCP or stop some instances, but these are optional, delayed and risky in production.
Answer: Anomaly detection learns your pattern. A gradual or sustained increase becomes the new normal, so it is not unusual relative to history. A budget compares spend with a fixed expectation and catches it.
Answer: ...you buy commitments with upfront payments (Savings Plans or Reserved Instances). Unblended shows the upfront fee as a lump on the day of purchase. Amortized spreads it over the term.
Answer: Resources not tagged, or the tag was not activated as a cost allocation tag (or was activated recently). Some charges also cannot carry tags, such as data transfer, taxes and support.
Answer: Showback reports what each team spent, without moving money. Chargeback transfers the cost to the team's budget. Most organisations start with showback to build trust in the numbers.
Interview questions
- How would you stop a cloud bill surprising the business? Tagging and account structure for attribution, per-account budgets with forecast alerts, anomaly detection with owners, a monthly review, and unit-cost reporting. Tooling is the easy part; ownership is the hard part.
- How soon can Cost Anomaly Detection catch a runaway resource? Within about a day, because it relies on Cost Explorer data that lags and runs a few times a day. For faster detection use CloudWatch usage metrics and alarms.
- What is unit economics in FinOps? Cost per business outcome, such as per 1,000 payments. It separates growth in cost from inefficiency.
- Would you let a budget shut down a production account? No for production. A human decision, with an on-call process, is safer. Use it in sandbox accounts.
Certification practice
A company wants an email when its forecasted monthly AWS spend is expected to exceed 5,000 USD. Which service should it use?
A. AWS Cost Explorer reports only. B. AWS Budgets with a forecasted alert. C. AWS Trusted Advisor. D. AWS Config.
Answer: B. AWS Budgets supports forecast-based notifications. Cost Explorer shows reports but does not alert by itself. Trusted Advisor gives recommendations. Config tracks configuration.
A bank with 50 accounts wants to detect unexpected cost spikes within about a day, with root-cause hints, and send alerts to a chat channel. Which solution meets this with the LEAST operational effort?
A. Custom Lambda polling the Cost Explorer API every hour. B. Cost Anomaly Detection monitors with an SNS subscription connected to Amazon Q Developer in chat applications. C. Monthly invoice review. D. A CloudWatch alarm on EstimatedCharges only.
Answer: B. The managed service provides machine-learning detection and root-cause hints and can notify through SNS to chat. A needs custom code and charges per API call. C is too slow. D is a single coarse metric with no root-cause detail.
An operations team wants to see monthly cost per business line even though business lines share some accounts. What should they use?
A. Separate invoices. B. Cost allocation tags activated in the management account, with a cost category. C. VPC Flow Logs. D. IAM Access Analyzer.
Answer: B. Tags give resource-level attribution inside shared accounts, and a cost category groups them. A does not exist as described. C and D are unrelated to cost.
Completion checklist
- I can explain inform, optimise and operate in two sentences
- I created a budget with actual and forecast alerts and an anomaly monitor
- I produced a report by account and by tag, and know which cost metric I used
- I calculated a unit cost for a product
- I ran the cleanup steps (keeping one budget and one monitor on my real account)
Key takeaways
- FinOps is a habit: make cost visible, owned and reviewed. Tools only support it.
- Budgets expect, anomaly detection notices. Use both, and use forecast alerts.
- Alerts are notifications and are delayed. They do not stop spending.
- Pick one cost metric and stick to it. Show unit costs, not only totals.
- Tags and accounts are how cost becomes someone's responsibility.
Further reading
Independent learning resource — not affiliated with, endorsed or sponsored by Amazon Web Services. AWS and related marks are trademarks of Amazon.com, Inc. or its affiliates. All banking data in examples is fictional. Sample architectures are for learning and are not automatically compliant with GDPR, PCI DSS or any banking regulation.
Compliance evidence: Config conformance packs, advanced queries and what still needs a human
Turn AWS Config into an evidence source an auditor can use: deploy a conformance pack, query resource inventory and configuration history, export a tamper-evident evidence bundle from C#, and be clear about what automation can never prove.
Cost and Usage Reports: billing data exports, Athena and showback
Export the most detailed AWS billing data with Data Exports (CUR 2.0), query it with Athena or DuckDB, and build a showback report that allocates direct and shared costs per cost centre.