ai newsDi., 1. Dez.

FinOps-KI-Agent für AWS: Cloud-Kosten vorhersagen, analysieren und optimieren

Wenn die AWS-Rechnung um 40 Prozent steigt, hilft ein KI-Agent bei der Analyse: EC2-Kosten, Data-Transfer-Gebühren und Entwicklungsumgebungen lassen sich automatisiert untersuchen und Optimierungen ableiten.

dev.toDienstag 04:33 · 01.12.DE12 Min. Lesezeit
Bild: dev.to

Was wäre, wenn Ihre AWS-Rechnung sich selbst erklären könnte?

Stellen Sie sich vor, Sie öffnen Ihr AWS-Billing-Dashboard und stellen fest, dass Ihre monatlichen Ausgaben um 40% gestiegen sind.

Die EC2-Kosten steigen. Datentransfergebühren wirken ungewöhnlich. Ihre Entwicklungsumgebung verbraucht mehr Ressourcen als erwartet.

Sie öffnen den AWS Cost Explorer, prüfen CloudWatch, untersuchen die Ressourcenauslastung und vergleichen mehrere Konten.

Stunden später entdecken Sie schließlich den Grund.

„Warum sind meine AWS-Ausgaben gestiegen, wie wird meine Rechnung nächsten Monat aussehen und wie kann ich Kosten senken, ohne die Produktion zu beeinträchtigen?“

Statt mehrere Dashboards manuell zu untersuchen, analysiert der Agent die Ausgaben, identifiziert ungewöhnliche Muster, untersucht mögliche Ursachen, prognostiziert künftige Kosten und empfiehlt Optimierungsmöglichkeiten.

Das ist die Grundidee hinter dem Aufbau eines FinOps-AI-Agents für AWS.

In diesem Artikel betrachten wir eine AWS-native Architektur mit Amazon Bedrock, AWS Cost Explorer, Cost Anomaly Detection, Cost Optimization Hub, Compute Optimizer, Lambda, EventBridge und Amazon S3.

Ein FinOps-AI-Agent ist ein intelligenter Assistent, der Organisationen hilft, Cloud-Ausgaben zu verstehen, vorherzusagen und zu optimieren.

Ein KI-gestützter FinOps-Agent sollte Folgendes erklären können:

„Die EC2-Ausgaben sind gestiegen, weil im Entwicklungskonto zusätzliche Instanzen gestartet wurden. Mehrere Instanzen zeigen durchgehend niedrige Auslastung. Prüfen Sie deren Konfigurationen und erwägen Sie Richtlinien zum geplanten Herunterfahren.“

Der Unterschied besteht darin, dass der Agent finanzielle Informationen mit operationalem Kontext verbindet.

Die Architektur kombiniert AWS-native Dienste für finanzielle Intelligenz mit einer KI-Reasoning-Schicht.

flowchart TD A["AWS Accounts and Workloads"] --> B["AWS Cost Explorer"] A --> C["Cost Anomaly Detection"] A --> D["Compute Optimizer"] A --> E["Cost Optimization Hub"] A --> F["CloudTrail"] B --> G["Cost Intelligence Layer"] D --> G E --> G C --> H["Amazon EventBridge"] H --> I["AWS Lambda"] G --> J["AWS Lambda Tools"] I --> K["Amazon Bedrock"] J --> K K --> L["FinOps AI Agent"] L --> M["Cost Analysis"] L --> N["Cost Forecasting"] L --> O["Optimization Recommendations"] L --> P["Conversational Interface"] M --> Q["Amazon S3 Reports"] N --> Q O --> R["Human Approval"] R --> S["Controlled AWS Actions"] L --> T["Amazon SNS"] L --> U["Amazon CloudWatch"] Key AWS services AWS Service Responsibility Amazon Bedrock AI reasoning and conversational interaction AWS Cost Explorer Historical cost and usage analysis Cost Anomaly Detection Detect unusual spending AWS Budgets Monitor financial thresholds Cost Optimization Hub Consolidated optimization opportunities AWS Compute Optimizer Resource optimization recommendations AWS CloudTrail Infrastructure change investigation Amazon EventBridge Event-driven workflows AWS Lambda Controlled agent tools and processing Amazon S3 Historical reports and cost data Amazon Athena SQL-based cost analysis AWS Glue Data cataloging Amazon SNS Alerts and notifications Amazon CloudWatch Operational monitoring 3. Workflow One: Intelligent Cost Analysis Die erste Aufgabe des Agents besteht darin zu verstehen, wohin das Geld fließt.

„Zeigen Sie mir unsere AWS-Ausgaben der letzten 30 Tage und identifizieren Sie die drei teuersten Services.“

Der Agent ruft eine kontrollierte Lambda-Funktion auf, die Kostendaten aus dem AWS Cost Explorer abruft.

Er kann Ausgaben nach Service, Konto, Region oder anderen unterstützten Dimensionen gruppieren.

AWS COST ANALYSIS Period: Last 30 Days Total Spending: $8,450 Top Services: Amazon EC2 $3,200 Amazon RDS $1,850 Amazon S3 $1,100 Other Services $2,300 Key Observation: EC2 represents approximately 38% of total AWS spending. Recommended Investigation: Review EC2 utilization, instance families, and non-production workloads. Enter fullscreen mode Exit fullscreen mode Diese Zahlen sind beispielhaft.

Der Agent sollte außerdem erläutern, welche Kostenmetrik er verwendet, etwa unblended cost oder amortized cost, um aussagekräftige Vergleiche zu gewährleisten.

Unerwartete Ausgaben gehören zu den größten finanziellen Herausforderungen in der Cloud.

Stellen Sie sich eine Anwendung vor, die normalerweise täglich 120 Dollar an AWS-Kosten verursacht.

Plötzlich steigen die täglichen Ausgaben auf 260 Dollar.

AWS Cost Anomaly Detection erkennt das ungewöhnliche Ausgabenmuster und sendet ein Ereignis an Amazon EventBridge.

EventBridge löst einen Lambda-Untersuchungs-Workflow aus.

sequenceDiagram participant CAD as Cost Anomaly Detection participant EB as EventBridge participant L as Lambda participant CE as Cost Explorer participant CT as CloudTrail participant AI as Amazon Bedrock participant SNS as Amazon SNS CAD->>EB: Anomaly detected EB->>L: Trigger investigation L->>CE: Retrieve cost breakdown L->>CT: Retrieve relevant activity CE-->>L: Cost information CT-->>L: Infrastructure events L->>AI: Submit investigation context AI-->>L: Generate findings L->>SNS: Send investigation report Der Agent untersucht, welche Services erhöhte Ausgaben verzeichneten, welche Konten und Regionen betroffen waren, welche Nutzungsarten zum Anstieg beitrugen und ob relevante Infrastrukturänderungen stattfanden.

COST ANOMALY INVESTIGATION Detected Increase: 116% Affected Service: Amazon EC2 Account: Development Region: us-east-1 Potential Contributors: - Additional EC2 instances launched. - Increased compute consumption. - Development workloads running overnight. Recommended Actions: - Review newly launched instances. - Check CPU and memory utilization. - Review development shutdown policies. - Validate workloads with their owners. Status: Awaiting Engineering Review Enter fullscreen mode Exit fullscreen mode Eine Anomalie ist ein Signal, kein Nachweis einer Ursache. Der Agent muss bestätigte Erkenntnisse von möglichen Erklärungen unterscheiden.

Noch wertvoller ist es zu wissen, was Sie im nächsten Monat möglicherweise ausgeben werden.

Der Agent kann Prognosen aus dem AWS Cost Explorer abrufen, um künftige Ausgaben zu schätzen.

CLOUD SPENDING FORECAST Current Monthly Spending: $8,450 Forecast for Next Month: $10,200 Expected Increase: 20.7% Potential Cost Drivers: - Increasing EC2 usage. - Growing database consumption. - Higher data transfer. - Increased storage usage. Recommended Action: Review projected growth with engineering and finance teams. Enter fullscreen mode Exit fullscreen mode Diese Zahlen sind beispielhaft.

Der Prognose-Workflow kann historische Kostendaten, von AWS erstellte Prognosen, Annahmen zum Workload-Wachstum, saisonale Nutzungsmuster und geplante Infrastruktur-Bereitstellungen kombinieren.

So verstehen Teams nicht nur, wie viel sie möglicherweise ausgeben, sondern auch, warum ihre Ausgaben steigen könnten.

Prognosen sind Schätzungen, keine garantierten Rechnungen. Der Agent sollte Unsicherheit kommunizieren und vermeiden, Vorhersagen als Fakten darzustellen.

Hier wird der FinOps-Agent besonders nützlich.

AWS Cost Optimization Hub bündelt Optimierungsmöglichkeiten, während AWS Compute Optimizer Empfehlungen auf Ressourcenebene für unterstützte Workloads liefert.

Identifizieren Sie Instanzen, die möglicherweise größer sind als ihre Workloads erfordern.

Finden Sie Ressourcen, die möglicherweise nicht mehr benötigt werden.

Prüfen Sie nicht angebundene Volumes und geeignete Änderungen der Speicherkonfiguration.

Bewerten Sie verfügbare Empfehlungen zur Datenbankoptimierung.

Prüfen Sie Lifecycle-Richtlinien und geeignete Speicherklassen basierend auf Zugriffsmustern.

Untersuchen Sie Gebühren für die Datenverarbeitung und unnötigen Netzwerkverkehr.

Bewerten Sie Kaufverpflichtungen anhand der tatsächlichen Auslastung, der Abdeckung und der erwarteten Stabilität der Workloads.

OPTIMIERUNGSMÖGLICHKEIT Ressource: i-0abc123example Aktuelle Konfiguration: m5.2xlarge Empfohlene Konfiguration: m5.xlarge Geschätzte monatliche Ersparnis: 85 $ Geschätzte jährliche Ersparnis: 1.020 $ Risikobewertung: Validieren Sie die CPU-, Arbeitsspeicher-, Netzwerk- und Anwendungsanforderungen. Status: Genehmigung erforderlich Vollbildmodus öffnen Vollbildmodus beenden Die Ressource und die Einsparungszahlen sind hypothetisch.

Der Agent sollte tatsächliche Empfehlungen von AWS-Services abrufen, anstatt Einsparungsschätzungen zu erfinden.

Er sollte außerdem eine doppelte Zählung überlappender Optimierungsmöglichkeiten vermeiden.

Amazon Bedrock stellt die Reasoning-Schicht für den FinOps-Assistenten bereit.

Der Agent sollte keinen uneingeschränkten AWS-Zugriff erhalten.

Stellen Sie stattdessen bestimmte Funktionen über AWS Lambda bereit.

Jedes Tool sollte ein klar definiertes Eingabe-Schema und Ausgabeformat haben.

Das folgende vereinfachte Python-Beispiel ruft die täglichen Ausgaben gruppiert nach Service ab.

import boto3 import json from datetime import date, timedelta ce = boto3. client ( "ce", region_name = "us-east-1" ) def lambda_handler ( event, context ): end_date = date. today ( ) start_date = end_date - timedelta ( days = 30 ) response = ce. get_cost_and_usage ( TimePeriod = { "Start": start_date. isoformat ( ), "End": end_date. isoformat ( ) }, Granularity = "DAILY", Metrics = [ "UnblendedCost" ], GroupBy = [ { "Type": "DIMENSION", "Key": "SERVICE" } ] ) results = [ ] for period in response [ "ResultsByTime" ]: for group in period [ "Groups" ]: results. append ( { "date": period [ "TimePeriod" ] [ "Start" ], "service": group [ "Keys" ] [ 0 ], "cost": float ( group [ "Metrics" ] [ "UnblendedCost" ] [ "Amount" ] ), "unit": group [ "Metrics" ] [ "UnblendedCost" ] [ "Unit" ] } ) return { "statusCode": 200, "body": json. dumps ( results ) } Vollbildmodus öffnen Vollbildmodus beenden Dies ist ein Startbeispiel und keine vollständige Produktionsimplementierung.

Eine Produktionsimplementierung sollte Eingabeparameter validieren, Autorisierung auf Kontenebene durchsetzen, API-Paginierung und Drosselung handhaben, Fehler verwalten und ein geeignetes Kostenmetrik verwenden.

Du bist ein AWS FinOps AI Agent. Deine Aufgaben: 1. Analysiere AWS-Kosten- und Nutzungsdaten.

2. Erkenne ungewöhnliche Ausgabemuster. 3.

Erkläre mögliche Kostentreiber. 4. Rufe Optimierungsempfehlungen ab.

5. Prognostiziere künftige Ausgaben. 6.

Erstelle FinOps-Berichte. Regeln: - Verwende autorisierte AWS-Tools für Kostendaten. - Erfinde niemals Ausgabenbeträge. - Unterscheide Schätzungen von tatsächlichen Kosten. - Erkläre die Grundlagen von Empfehlungen. - Berücksichtige Anwendungsleistung und Verfügbarkeit. - Ändere niemals Infrastruktur ohne Genehmigung. - Schütze sensible Kontoinformationen. - Eskaliere unsichere oder riskante Entscheidungen. Vollbildmodus öffnen Vollbildmodus beenden Das Kernprinzip lautet: Die KI interpretiert die Daten, während AWS-Services die Quelle der Wahrheit bleiben.

Organisationen, die mehrere AWS-Konten verwalten, benötigen möglicherweise tiefere Analysen, als Standard-API-Abfragen bieten können.

AWS Data Exports kann Kosten- und Nutzungsdatensätze an Amazon S3 liefern.

AWS Glue kann die Daten katalogisieren, und Amazon Athena kann sie per SQL abfragen.

flowchart LR A["AWS Cost and Usage Data"] --> B["AWS Data Exports"] B --> C["Amazon S3"] C --> D["AWS Glue Data Catalog"] D --> E["Amazon Athena"] E --> F["FinOps Lambda Tools"] F --> G["Amazon Bedrock"] G --> H["AI Cost Insights"] Eine SQL-Abfrage könnte beispielsweise die Ausgaben nach AWS-Service und Konto aggregieren:

SELECT line_item_product_code, line_item_usage_account_id, SUM ( line_item_unblended_cost ) AS total_cost FROM finops_cost_data WHERE year = '2026' AND month = '11' GROUP BY line_item_product_code, line_item_usage_account_id ORDER BY total_cost DESC; Vollbildmodus öffnen Vollbildmodus beenden Die Tabellen- und Spaltennamen sind beispielhaft und müssen dem Schema des exportierten Datensatzes entsprechen.

Diese Architektur ermöglicht Kostenzuordnung auf Anwendungsebene, Ausgabenanalysen auf Teamebene, Monatsvergleiche, Kosten pro Transaktion sowie Chargeback- oder Showback-Berichte.

Ein FinOps-Agent sollte nicht jede empfohlene Änderung automatisch umsetzen.

Eine EC2-Instance mit geringer CPU-Auslastung könnte während bestimmter Geschäftszeiten dennoch wichtige Workloads verarbeiten.

Eine Produktionsdatenbank könnte für saisonalen Verkehr zusätzliche Kapazität benötigen.

Eine Kaufverpflichtung könnte eine finanzielle Belastung schaffen, die für eine unvorhersehbare Workload ungeeignet ist.

flowchart TD A["AI Identifies Opportunity"] --> B["Collect Supporting Metrics"] B --> C["Estimate Savings and Risk"] C --> D["Generate Recommendation"] D --> E["Human Approval"] E -->|Approved| F["Execute Controlled Change"] E -->|Rejected| G["Record Decision"] F --> H["Validate Application Health"] H --> I["Measure Actual Cost Impact"] Verwenden Sie separate IAM-Rollen für Analysen und Infrastrukturänderungen.

Fordern Sie eine Genehmigung für Rightsizing in der Produktion, das Löschen von Ressourcen und finanzielle Verpflichtungen.

Dokumentieren Sie jede Aktion und pflegen Sie eine geeignete Rollback-Strategie.

Finanzdaten können Geschäftsprioritäten und die Infrastrukturarchitektur offenlegen.

Ein FinOps-Agent in der Produktion sollte strenge Sicherheitskontrollen einhalten.

IAM Least Privilege: Gib jeder Lambda-Funktion nur die Berechtigungen, die sie für ihre Aufgabe benötigt.

Getrennte Lese- und Schreibrollen: Halte Kostenanalysetools getrennt von Tools zur Infrastrukturänderung.

Autorisierung auf Kontenebene: Validiere, auf welche AWS-Konten und Kostenstellen ein Benutzer zugreifen darf.

Verschlüsselung: Schütze exportierte Kostendaten und erzeugte Berichte.

Auditierbarkeit: Verfolge Tool-Aufrufe, Genehmigungsentscheidungen und Infrastrukturänderungen.

Schutz vor Prompt Injection: Behandle abgerufene Ressourcenbeschreibungen, Tags und Benutzereingaben als nicht vertrauenswürdige Daten. Validiere alle Tool-Parameter.

Menschliche Aufsicht: Lasse niemals zu, dass allein eine KI-generierte Empfehlung eine weitreichende Änderung autorisiert.

Der Erfolg des Agents sollte anhand von Geschäftsergebnissen gemessen werden.

Eine Metrik verdient besondere Aufmerksamkeit: realisierte Einsparungen.

Ein Agent könnte monatliche Einsparungen von 5.000 $ identifizieren. Das bedeutet nicht, dass die Organisation tatsächlich 5.000 $ gespart hat.

Einsparungen werden erst real, nachdem sie umgesetzt und finanziell gegen eine geeignete Baseline validiert wurden.

AWS bietet jetzt den AWS FinOps Agent in der Vorschau an, unterstützt von Amazon Bedrock.

Er unterstützt die Untersuchung von Anomalien, Kostenabfragen in natürlicher Sprache, wiederkehrende Berichte und Optimierungsempfehlungen.

Für viele Organisationen ist diese verwaltete Funktion ein hervorragender Ausgangspunkt.

Ein eigener Agent wird dann sinnvoll, wenn man organisationsspezifische Genehmigungsworkflows, interne Integrationen, eine benutzerdefinierte Kostenzuordnung, spezialisierte Prognosen oder zusätzliche Governance-Kontrollen benötigt.

Meine Empfehlung lautet, zunächst den verwalteten AWS FinOps Agent zu evaluieren und eigene Funktionen dort aufzubauen, wo sie einen zusätzlichen Geschäftswert bieten.

Die Architektur kann sich zu einer breiteren Plattform für finanzielle Cloud-Intelligenz weiterentwickeln.

Stellen Sie sich vor, FinOps-Prüfungen in CI/CD-Pipelines zu integrieren, um Infrastrukturkosten vor der Bereitstellung abzuschätzen.

Stellen Sie sich vor, Amazon EKS-Workloads zu analysieren, um die Ressourcenkosten von Kubernetes zu verstehen.

Stellen Sie sich vor, die Infrastrukturkosten jeder einzelnen Kundentransaktion zu berechnen.

Stellen Sie sich vor, die finanziellen Auswirkungen einer neuen KI-Workload vor deren Start vorherzusagen.

Diese Funktionen können FinOps von einer monatlichen Berichtstätigkeit in eine kontinuierliche Engineering-Praxis verwandeln.

Cloud-Ausgaben sind nicht nur ein Problem der Finanzabteilung.

Es ist ein Problem von Engineering, Architektur, Betrieb und Business.

Durch die Kombination von Amazon Bedrock mit AWS Cost Explorer, Cost Anomaly Detection, AWS Budgets, Cost Optimization Hub, Compute Optimizer, Lambda, EventBridge und Amazon S3 können Organisationen ein intelligentes System aufbauen, das Cloud-Kostendaten in umsetzbare Entscheidungen verwandelt.

Das Ziel ist kein KI-Agent, der blindlings Ressourcen herunterfährt, um Geld zu sparen.

Es ist ein intelligenter Assistent, der Teams hilft, Ausgaben zu verstehen, zukünftige Kosten vorherzusagen und Infrastruktur zu optimieren, ohne Zuverlässigkeit oder Sicherheit zu gefährden.

Die Zukunft von FinOps besteht nicht nur darin, Cloud-Ausgaben zu überwachen, sondern darin, sie vorherzusagen, zu erklären und zu optimieren, bevor die Rechnung zur Überraschung wird.

Expand Abdullah Naseer Abdullah Naseer Abdullah Naseer Follow Need to know about me? I Can Be Your Manager Or a Worker Here's My Insta ID 👉: wogfl Come if you need Anything 🤞 Joined Oct 26, 2026 • Dec 1 Dropdown menu Copy link Hide Really stark geschriebener Artikel, Umair, das Beispiel mit der Anomalie von 120 bis 260 Dollar pro Tag war der Teil, der es für mich zum Klick gebracht hat, denn genau diese Art von Überraschung taucht über Nacht auf, und dein Satz, dass eine Anomalie ein Signal ist, kein Beweis für eine Ursache, ist das, was in den meisten Agent-Demos weggelassen wird.

Eines, das ich mir von dir noch weiter ausgearbeitet wünschen würde, ist die Schleife von der Empfehlung zu den realisierten Einsparungen. Du stellst fest, dass 5.000 Dollar an potenziellen monatlichen Einsparungen nicht 5.000 Dollar eingesparte Kosten sind, bis es umgesetzt und gegen eine Baseline verifiziert ist. Wie würdest du also den Agent einen Monat später zurückblicken und berichten lassen, ob das Rightsizing der m5.2xlarge tatsächlich die prognostizierte Einsparung geliefert hat? Dieser Verifikationsschritt fühlt sich für mich wie der Unterschied zwischen einem FinOps-Bericht und einem FinOps-Agent an.

Und von deinen vier „What's next“-Ideen, welche würdest du zuerst umsetzen, die Kostenschätzung vor dem Deploy im CI/CD-Prozess oder die Kosten pro Transaktion? Mein Instinkt sagt die CI/CD-Idee, da sie Ausgaben abfängt, bevor sie entstehen, aber ich bin gespannt, was du wählen würdest und warum.

Automatisch übersetzt. Das Original auf Englisch ist unten aufklappbar.

Original (Englisch) anzeigen

What if your AWS bill could explain itself?

Imagine opening your AWS billing dashboard and discovering that your monthly spending has increased by 40%.

EC2 costs are rising. Data transfer charges look unusual. Your development environment is consuming more resources than expected.

You open AWS Cost Explorer, check CloudWatch, investigate resource utilization, and compare multiple accounts.

Hours later, you finally discover the reason.

"Why did my AWS spending increase, what will my bill look like next month, and how can I reduce costs without affecting production?"

Instead of manually investigating multiple dashboards, the agent analyzes spending, identifies unusual patterns, investigates potential causes, forecasts future costs, and recommends optimization opportunities.

That's the idea behind building a FinOps AI Agent for AWS.

In this article, we'll explore an AWS-native architecture using Amazon Bedrock, AWS Cost Explorer, Cost Anomaly Detection, Cost Optimization Hub, Compute Optimizer, Lambda, EventBridge, and Amazon S3.

A FinOps AI Agent is an intelligent assistant that helps organizations understand, predict, and optimize cloud spending.

An AI-powered FinOps agent should explain:

"EC2 spending increased because additional instances were launched in the development account. Several instances show consistently low utilization. Review their configurations and consider scheduled shutdown policies."

The difference is that the agent connects financial information with operational context.

The architecture combines AWS-native financial intelligence services with an AI reasoning layer.

flowchart TD A["AWS Accounts and Workloads"] --> B["AWS Cost Explorer"] A --> C["Cost Anomaly Detection"] A --> D["Compute Optimizer"] A --> E["Cost Optimization Hub"] A --> F["CloudTrail"] B --> G["Cost Intelligence Layer"] D --> G E --> G C --> H["Amazon EventBridge"] H --> I["AWS Lambda"] G --> J["AWS Lambda Tools"] I --> K["Amazon Bedrock"] J --> K K --> L["FinOps AI Agent"] L --> M["Cost Analysis"] L --> N["Cost Forecasting"] L --> O["Optimization Recommendations"] L --> P["Conversational Interface"] M --> Q["Amazon S3 Reports"] N --> Q O --> R["Human Approval"] R --> S["Controlled AWS Actions"] L --> T["Amazon SNS"] L --> U["Amazon CloudWatch"] Key AWS services AWS Service Responsibility Amazon Bedrock AI reasoning and conversational interaction AWS Cost Explorer Historical cost and usage analysis Cost Anomaly Detection Detect unusual spending AWS Budgets Monitor financial thresholds Cost Optimization Hub Consolidated optimization opportunities AWS Compute Optimizer Resource optimization recommendations AWS CloudTrail Infrastructure change investigation Amazon EventBridge Event-driven workflows AWS Lambda Controlled agent tools and processing Amazon S3 Historical reports and cost data Amazon Athena SQL-based cost analysis AWS Glue Data cataloging Amazon SNS Alerts and notifications Amazon CloudWatch Operational monitoring 3. Workflow One: Intelligent Cost Analysis The first responsibility of the agent is understanding where the money is going.

"Show me our AWS spending for the last 30 days and identify the three most expensive services."

The agent calls a controlled Lambda function that retrieves cost data from AWS Cost Explorer.

It can group spending by service, account, Region, or other supported dimensions.

AWS COST ANALYSIS Period: Last 30 Days Total Spending: $8,450 Top Services: Amazon EC2 $3,200 Amazon RDS $1,850 Amazon S3 $1,100 Other Services $2,300 Key Observation: EC2 represents approximately 38% of total AWS spending. Recommended Investigation: Review EC2 utilization, instance families, and non-production workloads. Enter fullscreen mode Exit fullscreen mode These figures are illustrative.

The agent should also explain which cost metric it uses, such as unblended cost or amortized cost, to ensure meaningful comparisons.

Unexpected spending is one of the biggest cloud financial challenges.

Imagine an application that normally generates $120 in daily AWS costs.

Suddenly, daily spending increases to $260.

AWS Cost Anomaly Detection identifies the unusual spending pattern and sends an event to Amazon EventBridge.

EventBridge triggers a Lambda investigation workflow.

sequenceDiagram participant CAD as Cost Anomaly Detection participant EB as EventBridge participant L as Lambda participant CE as Cost Explorer participant CT as CloudTrail participant AI as Amazon Bedrock participant SNS as Amazon SNS CAD->>EB: Anomaly detected EB->>L: Trigger investigation L->>CE: Retrieve cost breakdown L->>CT: Retrieve relevant activity CE-->>L: Cost information CT-->>L: Infrastructure events L->>AI: Submit investigation context AI-->>L: Generate findings L->>SNS: Send investigation report The agent investigates which services experienced increased spending, which accounts and Regions were affected, which usage types contributed to the increase, and whether relevant infrastructure changes occurred.

COST ANOMALY INVESTIGATION Detected Increase: 116% Affected Service: Amazon EC2 Account: Development Region: us-east-1 Potential Contributors: - Additional EC2 instances launched. - Increased compute consumption. - Development workloads running overnight. Recommended Actions: - Review newly launched instances. - Check CPU and memory utilization. - Review development shutdown policies. - Validate workloads with their owners. Status: Awaiting Engineering Review Enter fullscreen mode Exit fullscreen mode An anomaly is a signal, not proof of a root cause. The agent must distinguish confirmed findings from potential explanations.

Knowing what you might spend next month is even more valuable.

The agent can retrieve AWS Cost Explorer forecasts to estimate future expenditure.

CLOUD SPENDING FORECAST Current Monthly Spending: $8,450 Forecast for Next Month: $10,200 Expected Increase: 20.7% Potential Cost Drivers: - Increasing EC2 usage. - Growing database consumption. - Higher data transfer. - Increased storage usage. Recommended Action: Review projected growth with engineering and finance teams. Enter fullscreen mode Exit fullscreen mode These figures are illustrative.

The forecasting workflow can combine historical cost data, AWS-generated forecasts, workload growth assumptions, seasonal usage patterns, and planned infrastructure deployments.

This helps teams understand not only how much they might spend but also why their spending could increase.

Forecasts are estimates, not guaranteed bills. The agent should communicate uncertainty and avoid presenting predictions as facts.

This is where the FinOps agent becomes especially useful.

AWS Cost Optimization Hub consolidates optimization opportunities, while AWS Compute Optimizer provides resource-level recommendations for supported workloads.

Identify instances that may be larger than their workloads require.

Find resources that may no longer be needed.

Review unattached volumes and suitable storage configuration changes.

Evaluate available database optimization recommendations.

Review lifecycle policies and suitable storage classes based on access patterns.

Investigate data processing charges and unnecessary network traffic.

Evaluate purchasing commitments using actual utilization, coverage, and expected workload stability.

OPTIMIZATION OPPORTUNITY Resource: i-0abc123example Current Configuration: m5.2xlarge Recommended Configuration: m5.xlarge Estimated Monthly Savings: $85 Estimated Annual Savings: $1,020 Risk Assessment: Validate CPU, memory, network, and application requirements. Status: Approval Required Enter fullscreen mode Exit fullscreen mode The resource and savings figures are hypothetical.

The agent should retrieve actual recommendations from AWS services instead of inventing savings estimates.

It should also avoid double-counting overlapping optimization opportunities.

Amazon Bedrock provides the reasoning layer for the FinOps assistant.

The agent should not receive unrestricted AWS access.

Instead, expose specific functions through AWS Lambda.

Each tool should have a clearly defined input schema and output format.

The following simplified Python example retrieves daily spending grouped by service.

import boto3 import json from datetime import date, timedelta ce = boto3. client ( "ce", region_name = "us-east-1" ) def lambda_handler ( event, context ): end_date = date. today ( ) start_date = end_date - timedelta ( days = 30 ) response = ce. get_cost_and_usage ( TimePeriod = { "Start": start_date. isoformat ( ), "End": end_date. isoformat ( ) }, Granularity = "DAILY", Metrics = [ "UnblendedCost" ], GroupBy = [ { "Type": "DIMENSION", "Key": "SERVICE" } ] ) results = [ ] for period in response [ "ResultsByTime" ]: for group in period [ "Groups" ]: results. append ( { "date": period [ "TimePeriod" ] [ "Start" ], "service": group [ "Keys" ] [ 0 ], "cost": float ( group [ "Metrics" ] [ "UnblendedCost" ] [ "Amount" ] ), "unit": group [ "Metrics" ] [ "UnblendedCost" ] [ "Unit" ] } ) return { "statusCode": 200, "body": json. dumps ( results ) } Enter fullscreen mode Exit fullscreen mode This is a starting example, not a complete production implementation.

A production implementation should validate input parameters, enforce account-level authorization, handle API pagination and throttling, manage errors, and use an appropriate cost metric.

You are an AWS FinOps AI Agent. Your responsibilities: 1. Analyze AWS cost and usage data. 2. Identify unusual spending patterns. 3. Explain potential cost drivers. 4. Retrieve optimization recommendations. 5. Forecast future spending. 6. Generate FinOps reports. Rules: - Use authorized AWS tools for cost data. - Never invent spending figures. - Distinguish estimates from actual costs. - Explain the evidence behind recommendations. - Consider application performance and availability. - Never modify infrastructure without approval. - Protect sensitive account information. - Escalate uncertain or high-risk decisions. Enter fullscreen mode Exit fullscreen mode The key principle is that the AI interprets the data, while AWS services remain the source of truth.

Organizations managing multiple AWS accounts may need deeper analysis than standard API queries provide.

AWS Data Exports can deliver cost and usage datasets to Amazon S3.

AWS Glue can catalog the data, and Amazon Athena can query it using SQL.

flowchart LR A["AWS Cost and Usage Data"] --> B["AWS Data Exports"] B --> C["Amazon S3"] C --> D["AWS Glue Data Catalog"] D --> E["Amazon Athena"] E --> F["FinOps Lambda Tools"] F --> G["Amazon Bedrock"] G --> H["AI Cost Insights"] For example, a SQL query could aggregate spending by AWS service and account:

SELECT line_item_product_code, line_item_usage_account_id, SUM ( line_item_unblended_cost ) AS total_cost FROM finops_cost_data WHERE year = '2026' AND month = '11' GROUP BY line_item_product_code, line_item_usage_account_id ORDER BY total_cost DESC; Enter fullscreen mode Exit fullscreen mode The table and column names are illustrative and must match the exported dataset schema.

This architecture enables application-level cost attribution, team-level spending analysis, monthly comparisons, cost per transaction, and chargeback or showback reporting.

A FinOps agent should not automatically make every change it recommends.

An EC2 instance with low CPU utilization might still be handling important workloads during specific business hours.

A production database might require additional capacity for seasonal traffic.

A purchasing commitment might create a financial obligation that is unsuitable for an unpredictable workload.

flowchart TD A["AI Identifies Opportunity"] --> B["Collect Supporting Metrics"] B --> C["Estimate Savings and Risk"] C --> D["Generate Recommendation"] D --> E["Human Approval"] E -->|Approved| F["Execute Controlled Change"] E -->|Rejected| G["Record Decision"] F --> H["Validate Application Health"] H --> I["Measure Actual Cost Impact"] Use separate IAM roles for analysis and infrastructure changes.

Require approval for production rightsizing, resource deletion, and financial commitments.

Record every action and maintain an appropriate rollback strategy.

Financial data can reveal business priorities and infrastructure architecture.

A production FinOps agent should follow strong security controls.

IAM Least Privilege: Give each Lambda function only the permissions needed for its task.

Separate Read and Write Roles: Keep cost analysis tools separate from infrastructure modification tools.

Account-Level Authorization: Validate which AWS accounts and cost centers a user can access.

Encryption: Protect exported cost data and generated reports.

Auditability: Track tool calls, approval decisions, and infrastructure changes.

Prompt Injection Protection: Treat retrieved resource descriptions, tags, and user input as untrusted data. Validate all tool parameters.

Human Oversight: Never allow an AI-generated recommendation alone to authorize a high-impact change.

The success of the agent should be measured through business outcomes.

One metric deserves special attention: realized savings.

An agent might identify $5,000 in potential monthly savings. That does not mean the organization has actually saved $5,000.

Savings become real only after implementation and financial validation against an appropriate baseline.

AWS now offers the AWS FinOps Agent in preview, powered by Amazon Bedrock.

It supports anomaly investigations, natural-language cost inquiries, recurring reports, and optimization recommendations.

For many organizations, this managed capability is an excellent starting point.

A custom agent becomes useful when you need organization-specific approval workflows, internal integrations, custom cost allocation, specialized forecasting, or additional governance controls.

My recommendation is to evaluate the managed AWS FinOps Agent first and build custom capabilities where they provide additional business value.

The architecture can evolve into a broader cloud financial intelligence platform.

Imagine integrating FinOps checks into CI/CD pipelines to estimate infrastructure costs before deployment.

Imagine analyzing Amazon EKS workloads to understand Kubernetes resource costs.

Imagine calculating the infrastructure cost of each customer transaction.

Imagine forecasting the financial impact of a new AI workload before launching it.

These capabilities can turn FinOps from a monthly reporting activity into a continuous engineering practice.

Cloud spending is not just a finance problem.

It is an engineering, architecture, operational, and business problem.

By combining Amazon Bedrock with AWS Cost Explorer, Cost Anomaly Detection, AWS Budgets, Cost Optimization Hub, Compute Optimizer, Lambda, EventBridge, and Amazon S3, organizations can build an intelligent system that transforms cloud cost data into actionable decisions.

The objective is not an AI agent that blindly shuts down resources to save money.

It is an intelligent assistant that helps teams understand spending, predict future costs, and optimize infrastructure without compromising reliability or security.

The future of FinOps is not just monitoring cloud spending. It is predicting, explaining, and optimizing it before the bill becomes a surprise.

Expand Abdullah Naseer Abdullah Naseer Abdullah Naseer Follow Need to know about me? I Can Be Your Manager Or a Worker Here's My Insta ID 👉: wogfl Come if you need Anything 🤞 Joined Oct 26, 2026 • Dec 1 Dropdown menu Copy link Hide Really strong write-up, Umair — the $120 to $260 a day anomaly example is the part that made this click for me, because that is exactly the shape of surprise that shows up overnight, and your line that an anomaly is a signal, not proof of a root cause, is the bit most agent demos skip.

One thing I would love to see you push further is the loop from recommendation to realized savings. You flag that $5,000 in potential monthly savings is not $5,000 saved until it is implemented and verified against a baseline — so how would you have the agent check back a month later and report whether the m5.2xlarge rightsizing actually delivered the saving it predicted? That verification step feels like the difference between a FinOps report and a FinOps agent.

And of your four "what's next" ideas, which would you build first — the CI/CD cost estimate before deploy, or cost per transaction? My instinct is the CI/CD one, since it catches spend before it exists, but I am curious what you would pick and why.

Originaltitel: Building a FinOps AI Agent for AWS: Predict, Analyze, and Optimize Cloud SpendingQuelle: dev.to (dev.to). Original öffnen