Track AI Infrastructure Spend Across Cloud Providers
This guide shows you how to set up a simple, repeatable system for tracking AI infrastructure spending across AWS, Azure, and Google Cloud. You’ll learn what data to collect, how to normalize it into a single view, and how to avoid the most common pitfalls that make cloud cost tracking inaccurate.
What You’ll Need
- Access to billing or cost management consoles for each cloud provider you use (AWS Cost Explorer, Azure Cost Management, Google Cloud Billing).
- Permission to view cost reports and export billing data (at minimum, read-only access).
- A spreadsheet tool (Excel, Google Sheets) or a BI dashboard (Power BI, Tableau) to consolidate the data.
- A naming convention or tagging strategy for your AI resources (e.g., tag all GPU instances with
workload=ai-training). - An understanding of what counts as “AI infrastructure” in your organization — typically GPU/TPU instances, AI platform services, and associated storage and networking.
Step-by-Step
- Define what “AI infrastructure” means for your org. List the specific services and resource types that you will include. Common items: GPU/TPU virtual machines (AWS P/G instances, Azure NV/NC series, Google Cloud A2/A3), managed AI platforms (SageMaker, Azure ML, Vertex AI), and supporting storage (S3, Azure Blob, GCS) and networking (data transfer, load balancers). Exclude general-purpose compute unless it’s clearly used for AI workloads.
- Apply consistent tagging to all AI resources. In each cloud provider, create a mandatory tag/key like
cost-center=aiorworkload=ml. Enforce it via policy (AWS SCP, Azure Policy, GCP Organization Policy) so new resources can’t be created without it. This is the single most important step for accurate tracking. - Set up daily cost exports for each provider. Use the native tools: AWS Cost and Usage Report (CUR) to S3, Azure Cost Management exports to storage, and Google Cloud Billing Export to BigQuery. Schedule daily exports so you always have fresh data.
- Create a unified cost table. Build a spreadsheet or database with columns: date, provider, service, resource ID, tag (e.g., workload), usage amount, unit, cost (in USD), and currency. If you have multiple currencies, convert to a single currency using the provider’s billing exchange rate for that day.
- Pull data into your central table. For a manual process, download CSV exports from each provider and paste them into the table. For automation, use cloud provider APIs (AWS Cost Explorer API, Azure Cost Management API, GCP Cloud Billing API) to fetch data programmatically into a data warehouse or Google Sheets via scripts.
- Normalize service names and units. Each provider uses different names for similar things. Map them to a common taxonomy, e.g., “GPU Compute” for all P/G/NC/A2 instances. Convert usage units to a common base (e.g., vCPU-hours, GB-month) if you want to compare usage, but for cost tracking, the dollar amount is what matters.
- Build a monthly summary dashboard. Create pivot tables or charts showing: total AI spend by provider, by service, by workload tag, and month-over-month change. Include a column for “% of total cloud spend” to see the AI share.
- Set up anomaly alerts. Use each provider’s budget alerts (AWS Budgets, Azure Budgets, GCP Budgets) to notify you when AI spend exceeds a threshold, e.g., 20% above the monthly forecast. Also set up a simple rule in your spreadsheet to flag days where spend is more than 2x the 30-day average.
- Review and reconcile weekly. Spend 15 minutes each week comparing the provider dashboards to your central table. Look for untagged resources, unexpected spikes, or services you forgot to include.
- Document your process. Write a short internal wiki page that lists what’s included, how tags work, where the exports are, and who to contact for access. This ensures the system survives team changes.
Common Mistakes
- Forgetting to tag everything. Untagged resources are invisible in your tracking. Enforce tagging with policies, not just best practice.
- Mixing currencies without conversion. If you operate in multiple regions, you’ll get costs in different currencies. Always convert to a single currency using the daily exchange rate, or you’ll get misleading totals.
- Including non-AI costs. Be strict about what counts. If you tag everything with “AI” just because it’s in the same project, your numbers will be inflated. Use specific tags like
workload=trainingvsworkload=serving. - Ignoring data transfer costs. Moving training data in and out of cloud storage can be a significant part of AI spend. Make sure to include egress and inter-region transfer fees.
- Only looking at monthly totals. AI workloads can spike daily. Weekly or daily granularity helps you catch runaway jobs early.
- Not reconciling with the provider invoice. Exports can lag or have rounding differences. Always compare your totals to the actual invoice to catch discrepancies.
Tips
- Start with a simple spreadsheet. Don’t over-engineer with complex BI tools until you’ve manually tracked for a month and know what questions you need to answer.
- Use resource tags for both cost and usage. Tag not just “AI” but also the specific project (e.g., “project=llm-finetune”) so you can break down spend by team or experiment.
- Leverage provider cost categories. AWS has “Cost Categories,” Azure has “Cost Allocation Rules,” and GCP has “Cost Breakdown” — use them to group AI-related services automatically.
- Automate the export to a cloud storage bucket. Even if you don’t automate the ingestion yet, having daily CSV files in one place makes manual updates easier.
- Schedule a monthly review meeting. Share the dashboard with team leads and discuss any anomalies. This keeps everyone accountable for their resource usage.
- Consider using spot/preemptible instances for non-critical training. This can cut costs dramatically, but make sure your tracking captures the lower rate correctly.
Troubleshooting
- Data is missing for some days. Exports can be delayed by up to 24 hours. Check the provider’s export status. If it’s a recurring issue, set up a daily job that backfills missing data.
- Tags aren’t showing up in cost reports. Tagging changes can take up to 24-48 hours to appear in billing data. Also, ensure you’re using the correct tag key and that it’s applied at the resource level, not just the project.
- Costs seem too high. Check for resources that are running 24/7 but only used occasionally. Look for GPU instances left on after training. Use the provider’s usage reports to identify idle resources.
- Provider exports have different formats. Don’t try to merge them manually every time. Write a small script (Python or even spreadsheet formulas) that transforms each export into your standard format.
- Cannot access billing APIs. You need the right IAM roles. For AWS, you need
ce:GetReservationUtilizationandce:GetCostAndUsage. For Azure, you need the “Cost Management Reader” role. For GCP, you need “Billing Account Viewer.” - Currency conversion is off. Use the provider’s billing currency conversion rate for the day, not a live market rate. The provider’s rate is what’s on your invoice.
Frequently Asked Questions
Q: Can I track AI spend without using tags?
A: Yes, but it’s much harder. You can filter by service type (e.g., all GPU instances) and by resource name patterns, but tags are the most reliable way to isolate AI workloads.
Q: How often should I update the tracking?
A: At least daily for exports, and review the dashboard weekly. Monthly reviews are too infrequent to catch cost spikes early.
Q: What if I use multiple cloud providers?
A: That’s exactly what this guide is for. The key is to normalize each provider’s data into a common format and then combine it in one place. Use a consistent currency and date format.
Q: Should I include storage costs for datasets?
A: Yes, if the storage is used primarily for AI training data. Use a tag like data=training to include it. If you aren’t sure, include it and mark it as “AI-supporting” so you can exclude it later if needed.
Q: How do I handle costs for shared services like load balancers?
A: Allocate them based on the proportion of traffic that comes from AI workloads, or simply tag them as AI if they are dedicated to AI services. Be consistent with your allocation method.
Q: Can I automate the whole process?
A: Yes. Use cloud APIs to pull data into a data warehouse (e.g., BigQuery, Snowflake) and then connect it to a BI tool. This requires some engineering effort but eliminates manual work.
Related
Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.