Track and reduce AWS spend for a running workload
Break spend down with Cost Explorer and tags, catch anomalies, and compare commitments with on-demand spend for sample workloads.
By Invicly Tech, , in AWS Cloud Engineering. About 11 minutes to read.
In short
FinOps is the habit of looking at cloud spend as often as you look at errors. With cost allocation tags and Cost Explorer you can see what each service and team costs, anomaly detection warns you about surprises, and right-sizing plus commitments such as Savings Plans lower the steady part of the bill.
Think of it like this: Tags are labels on every receipt, Cost Explorer is the spreadsheet of receipts, and anomaly detection is the bank text that says your card was used somewhere odd.
Explained simply
Cloud bills grow quietly. A forgotten test server, logs kept forever or traffic through a NAT gateway can each add a surprising amount. FinOps is the practice of making cost visible to the people who build and run the service, so they can make sensible trade-offs, just as they do with speed and reliability.
The first step is knowing who spent what. Tags are labels such as project=files or env=prod that you put on resources. Once you activate them as cost allocation tags in the Billing console, Cost Explorer can split the bill by project, team or environment.
The second step is catching surprises early. AWS Budgets sends an alert when actual or forecast spend crosses a limit. Cost Anomaly Detection learns what normal looks like for a service or tag and tells you when spend jumps, even if you are still under budget.
The third step is paying less for the same work: delete what is idle, shrink what is too big, scale with demand, and for the steady baseline buy a commitment such as a Savings Plan, which gives a lower rate in return for promising a set spend per hour for one or three years.
Press Play on a diagram to walk through it one step at a time.
- 1Tag
project, env and owner on every resource
- 2See
Cost Explorer grouped by tag and service
- 3Alert
Budgets and anomaly detection
- 4Optimise
Delete idle, right-size, scale with demand
- 5Commit
Savings Plans for the steady baseline
- Back to step 1
- 1Spikes
Batch runs, launches: on demand or Spot
- 2Daily variation
Scale with demand; on demand
- 3Steady baseline
Runs 24/7: candidate for Savings Plans
- 4Waste
Idle and oversized: remove before anything else
In depth
Tags and Cost Explorer
Pick a small tag set and enforce it: project, env and owner are enough to start. Apply tags in your IaC so every resource gets them, and use tag policies in AWS Organizations to standardise spelling. User-defined tags must be activated as cost allocation tags in Billing and Cost Management; they can take up to 24 hours to appear. Billing also lets you request a backfill of tag data for past months, but untagged resources stay untagged.
Cost Explorer shows the last 13 months by default and a forecast. Group by service, then by usage type to see what really drives the cost: for example NatGateway-Bytes, TimedStorage-ByteHrs or DataProcessing-Bytes. Filter by the project tag to see one workload. Remember that some costs, like data transfer, cannot be tagged and land in the untagged bucket.
- Activate tags before you need the report
- Group by usage type to find the real driver
- Cost categories group accounts and tags into business views
- The Cost Explorer API charges per request
Budgets and anomaly detection
Budgets compare spend to a number you choose. Set alerts at actual and forecasted thresholds, for example 80 percent forecast and 100 percent actual, and send them to email or an SNS topic. Budget actions can apply an IAM policy or stop instances when a limit is crossed, which suits sandbox accounts.
Cost Anomaly Detection uses machine learning to learn normal spend patterns. You create a monitor, for example for all AWS services or for one cost allocation tag, and an alert subscription with a threshold in dollars or percent. Alerts arrive individually or as daily or weekly summaries, and each anomaly shows the likely root cause: the service, account, Region and usage type. The feature itself has no charge.
Budgets catch slow growth past a limit; anomaly detection catches sudden jumps well below it. Use both.
- You set a fixed limit
- Alerts on actual or forecast
- Good for sandbox caps
- Can trigger budget actions
- Learns normal patterns
- Alerts on unusual jumps
- Shows likely root cause
- No charge for the feature
Hidden costs in a running workload
NAT gateways charge per hour and per GB processed. A private Lambda or container that downloads from S3 through NAT pays for every byte; an S3 or DynamoDB gateway endpoint carries that traffic at no charge. CloudWatch Logs charges for ingestion and storage, and log groups never expire by default, so set retention and avoid debug logging in production. Public IPv4 addresses are charged per hour, including idle Elastic IPs.
Idle resources are the classic waste: load balancers with no targets, unattached EBS volumes, old snapshots, stopped instances with large disks, and forgotten dev environments. Over-provisioned resources are the next: instances at 5 percent CPU, Lambda functions with far more memory than they use. AWS Compute Optimizer gives right-sizing recommendations for EC2, Auto Scaling groups, EBS, Lambda and more.
Finally, scale with demand: queue-based scaling for workers, schedules that turn off non-production environments at night.
- NAT data processing: use gateway endpoints for S3 and DynamoDB
- Logs: set retention, sample debug logs
- Idle: load balancers, EBS volumes, snapshots, Elastic IPs
- Right-size with Compute Optimizer, then re-check
Commitments versus on demand
On demand is flexible: you pay only for what runs. Commitments trade flexibility for a lower rate. Compute Savings Plans apply to EC2, Fargate and Lambda in any Region and instance family. EC2 Instance Savings Plans give a deeper discount but lock to one instance family in one Region. SageMaker AI Savings Plans cover SageMaker usage. You commit to a dollar amount per hour for 1 or 3 years, paid all upfront, partially upfront or with no upfront payment.
The rule of thumb: commit only to the baseline you are confident will run for the whole term, after right-sizing. Look at the lowest hourly spend over recent months, not the average. Leave spikes and experiments on demand, and use Spot for interruptible batch work. The Billing console shows Savings Plans recommendations, utilisation and coverage so you can see whether the commitment is fully used.
- Right-size first, commit second
- Commit to the floor, not the average
- Track utilisation (is it used?) and coverage (how much is covered?)
- Spot suits retryable batch jobs
Learn it in 5 short steps
About 30m each. Track them with a timer in your plan.
- 1Group costs by allocation tag~30m
- 2Set up cost anomaly detection~30m
- 3Spot NAT, log and idle costs~30m
- 4Right-size and scale with demand~30m
- 5Compare Savings Plans and on-demand~30m
Key points
- User-defined tags only show in billing after you activate them as cost allocation tags.
- NAT gateway data processing, log ingestion and idle resources are common hidden costs.
- Gateway endpoints for S3 and DynamoDB carry traffic without NAT charges.
- Commit only to the usage you are sure of; keep spiky or short-lived load on demand.
- Compute Savings Plans apply to EC2, Fargate and Lambda, across Regions and instance families.
Key terms
Tap a card to flip it. 0/5 known
Examples
aws ce get-cost-and-usage \
--time-period Start=2026-11-01,End=2026-12-01 \
--granularity MONTHLY --metrics UnblendedCost \
--group-by Type=TAG,Key=project
# Each Cost Explorer API request is billed (0.01 USD at the time of writing)Group last month's spend by the project tag. The end date is exclusive.
Finding why the lab bill doubled
The files project cost 40 USD last month and 85 USD this month. Step 1: Cost Explorer, filter project=files, group by service. EC2-Other grew most. Step 2: group by usage type: NatGateway-Bytes went from 20 GB to 900 GB. Step 3: check the worker; a new feature downloads every source file from S3 through the NAT gateway. Step 4: add an S3 gateway endpoint to the private route tables. Expected evidence: NatGateway-Bytes falls within a day or two, and the worker still works. Rollback: remove the endpoint route if anything breaks.
aws ec2 create-vpc-endpoint --vpc-id vpc-0abc1234 \
--vpc-endpoint-type Gateway \
--service-name com.amazonaws.eu-west-1.s3 \
--route-table-ids rtb-0private1 rtb-0private2Comparing a Savings Plan with on demand (illustrative rates)
Workload A runs 24/7 with a steady 1.00 USD per hour of Fargate on demand. Workload B is a nightly batch, 4 hours a day at 3.00 USD per hour. Assume a 1-year Compute Savings Plan gives a 30 percent discount (rates are made up for the exercise). For A, commit 0.70 USD per hour: it covers the full 1.00 USD of on-demand usage, saving about 0.30 x 8,760 = 2,628 USD a year. For B, a commitment would sit unused 20 hours a day, so keep it on demand or move it to Spot. Commit to the floor (A), not the peak.
Quick reference
- Activate user-defined tags as cost allocation tags; allow up to 24 hours
- Group by usage type to see drivers such as NatGateway-Bytes
- Budgets = fixed limits; Cost Anomaly Detection = unusual jumps, no charge
- S3 and DynamoDB gateway endpoints avoid NAT data processing charges
- Set log retention; log groups never expire by default
- Compute Savings Plans cover EC2, Fargate and Lambda across Regions
- Right-size first, then commit to the lowest steady hourly spend
Common mistakes
- Buying a 3-year commitment for a workload that may be redesigned next quarter.
- Leaving a NAT gateway in a lab VPC that nobody uses; it charges every hour.
- Expecting new tags to label old costs automatically; plan tags before you deploy.
Quick quiz
Pick an answer to see if you're right and why.
Practice exercises
Try each one yourself first. Use the hint if you get stuck, then compare with the solution.
- Exercise 1easy
Create a monthly cost budget of 10 USD for your sandbox account with an email alert at 80 percent of forecast spend.
- Exercise 2medium
Find the top three usage types for one project tag last month with the CLI.
- Exercise 3hard
Write a cost review for the file-processing service: list five likely cost drivers, the metric or report that shows each, and one action for each.
Check yourself
Answer in your head, reveal, then be honest with yourself.
Feel confident about this topic?
Frequently asked questions
- Why does my tag not show in Cost Explorer?
- User-defined tags must be activated as cost allocation tags in the Billing console, and data can take up to 24 hours to appear. Costs from before tagging stay untagged unless you request a backfill.
- Is Cost Explorer free?
- Viewing Cost Explorer in the console has no charge. API requests through the CLI or SDKs are billed per request, so cache results in scripts.
- Savings Plans or Reserved Instances?
- For compute, Savings Plans are simpler and more flexible. Reserved Instances still matter for services that Savings Plans do not cover, such as some database services.