AWS Builder Center
Weekend Agent Challenge: The AWS Cost Guardian

Weekend Agent Challenge: The AWS Cost Guardian

A personal AI-powered FinOps agent that never sleeps. Every night, it wakes up, scans your AWS account for idle and expensive resources, estimates unnecessary spending, and delivers a simple report with cost-saving recommendations—so you wake up knowing exactly what to stop before your AWS bill grows.

Community Builder and Browserstack Champion
This weekend's challenge was all about building an AI agent that works on its own. Instead of waiting for someone to open an app or click a button, the agent wakes up on a schedule, performs a useful task, and has the results ready when you return. That immediately got me thinking about a common problem many AWS users face - unexpected cloud costs caused by forgotten or underutilized resources.
That's how I came up with AWS Cost Guardian - an autonomous AI-powered FinOps agent that wakes up every night, scans my AWS account for idle and underutilized resources, estimates unnecessary cloud spend, and uses Amazon Nova to generate clear, actionable recommendations. Rather than manually checking the AWS Console every day, I receive a personalized report in my inbox each morning, highlighting what can be stopped, optimized, or investigated before it impacts my monthly bill. The goal is simple: let AI monitor my cloud costs, so I can focus on building.



Vision & What the Agent Does

The core idea is simple: cloud costs shouldn't depend on someone remembering to check the AWS Console every day. Most cost optimization tools provide dashboards and reports, but they only help if you remember to open them. I wanted the opposite-an AI agent that watches over your AWS account automatically and only reaches out when there's something worth your attention.
Here's how it works:
Setup, once. Configure the AWS account, choose the AWS Region, set a daily scan time, and provide an email address for notifications.
It runs on its own, every night. Using Amazon EventBridge Scheduler, the agent wakes up at the configured time and scans your AWS environment. It discovers resources across services such as EC2, RDS, EBS, Elastic IPs, Load Balancers, EKS, SageMaker, and CloudWatch Logs.
It investigates instead of just reporting. Rather than listing resources, the agent collects operational context-instance age, utilization, resource state, and configuration-and asks Amazon Nova to analyze the findings. The AI identifies idle or underutilized resources, estimates potential cost savings, assesses the impact of taking action, and prioritizes recommendations.
It delivers a personalized FinOps report. Instead of requiring you to log into another dashboard, the agent sends a concise email summarizing the most important findings. Each recommendation explains what was discovered, why it matters, the estimated savings, and whether it's safe to optimize or stop the resource.
It keeps working in the background. Every night, the agent continuously monitors your cloud environment, helping you catch forgotten resources before they become expensive surprises. The goal isn't just to generate reports-it's to act like a personal FinOps assistant that proactively helps you reduce unnecessary cloud spending while you focus on building applications.




How I Built It

From the beginning, I wanted AWS Cost Guardian to be completely serverless and autonomous. Once configured, it shouldn't require anyone to log into a dashboard or remember to run a script. Instead, it should quietly monitor the AWS environment on a schedule, analyze cloud resources with AI, and deliver actionable recommendations before the day begins.
Frontend: React (Vite) for configuration and viewing historical cost reports.
Backend: Python AWS Lambda functions responsible for resource discovery, AI analysis, and report generation.
Infrastructure: AWS SAM for defining and deploying the entire serverless architecture.
Scheduler: Amazon EventBridge Scheduler, which wakes the agent every night at the configured time.
AI: Amazon Bedrock using Amazon Nova Lite to analyze AWS resources, identify optimization opportunities, estimate potential savings, and generate human-friendly recommendations.
Resource Discovery: AWS SDK (boto3) scans services including EC2, RDS, EBS, Elastic IPs, Load Balancers, EKS, SageMaker, and CloudWatch Logs.
Storage: Amazon DynamoDB stores scan history, previous recommendations, and optimization trends.
Notifications: Amazon SES delivers a daily Cost Guardian report directly to your inbox.
One architectural decision I particularly liked was separating resource discovery from AI reasoning. The Lambda function first gathers factual information from AWS APIs-resource states, utilization, and configuration-and only then passes a structured summary to Amazon Nova. This keeps the AI focused on what it does best: interpreting operational data, estimating cost-saving opportunities, prioritizing recommendations, and explaining everything in clear, actionable language. The result is an autonomous FinOps agent that feels more like a cloud advisor than just another reporting tool.



Key Decisions & Challenges

Key decision: keeping the agent autonomous

The most important design decision was making sure the agent truly worked on its own. I didn't want another dashboard that required me to remember to log in every day. Instead, Amazon EventBridge Scheduler wakes the agent every night, triggers a Lambda function, scans my AWS account, and sends me a personalized cost optimization report before I even think about opening the AWS Console. The entire workflow is event-driven and completely serverless.

Challenge: estimating costs without relying on Cost Explorer

Initially, I considered using AWS Cost Explorer APIs to calculate savings. While powerful, they require additional permissions and historical billing data, making them less suitable for a lightweight weekend project. Instead, the agent focuses on identifying idle and underutilized resources using AWS APIs—such as stopped instances, unattached EBS volumes, idle Elastic IPs, and low-utilization compute resources—and then uses Amazon Nova to estimate potential savings and explain the recommendations in plain English.

Challenge: separating data collection from AI reasoning

Another key architectural decision was ensuring the AI never queried AWS resources directly. A dedicated Lambda function first collects factual information using boto3 and converts it into a structured JSON summary. Only then is that context passed to Amazon Nova. This separation keeps the AI focused on analysis and recommendations while AWS APIs remain the single source of truth for infrastructure data.

Challenge: secure AWS access

Because the agent scans AWS resources automatically, security was a top priority. Instead of embedding credentials or long-lived access keys, the Lambda function runs with a least-privilege IAM role that grants read-only access only to the AWS services it needs. This follows AWS security best practices while ensuring the agent can safely perform scheduled scans without exposing sensitive credentials.

Challenge: keeping reports useful instead of overwhelming

A typical AWS account can contain hundreds of resources, and simply listing them isn't helpful. Rather than sending a long inventory, Amazon Nova prioritizes the findings by impact, explains why each recommendation matters, estimates the potential savings, and highlights only the most important optimization opportunities. The result feels less like a raw report and more like advice from a FinOps consultant.



AWS Services Used / Architecture Overview

Amazon EventBridge Scheduler — the heartbeat of the system. Triggers the Cost Guardian agent every night at the configured time without requiring any manual intervention.
AWS Lambda (Python) — multiple Lambda functions handle resource discovery, AI analysis, report generation, and email notifications. Each function has a single responsibility, making the solution modular and easy to extend.
Amazon Bedrock (Amazon Nova Lite) — analyzes the discovered AWS resources, identifies idle or underutilized infrastructure, estimates potential savings, prioritizes optimization opportunities, and generates human-friendly recommendations in plain English.
AWS SDK for Python (boto3) — collects operational data from AWS services including EC2, RDS, EBS, Elastic IPs, Load Balancers, EKS, SageMaker, CloudWatch Logs, and other supported services.
Amazon DynamoDB — stores scan history, previous recommendations, optimization trends, and execution metadata, allowing users to track improvements over time.
Amazon Simple Email Service (SES) — delivers a personalized daily Cost Guardian report containing prioritized findings, estimated savings, and recommended actions directly to the user's inbox.
AWS IAM — provides least-privilege permissions, allowing the agent to securely perform read-only resource discovery without exposing long-lived credentials.
AWS SAM — defines and deploys the complete serverless infrastructure as code, making the solution repeatable and easy to maintain.

How the agent is triggered

Amazon EventBridge Scheduler invokes the Cost Guardian Lambda every night at the configured time-no dashboard, button, or manual execution required. The Lambda scans the AWS account, gathers operational data from supported services using boto3, and builds a structured inventory of cloud resources. That inventory is then sent to Amazon Nova, which analyzes the environment, identifies cost optimization opportunities, estimates potential savings, and prioritizes recommendations. Finally, the agent generates a concise HTML report and emails it to the user via Amazon SES. The entire workflow runs autonomously, allowing users to wake up each morning with actionable insights instead of unexpected cloud costs.
Architecture diagram


Agent-Flow Sequence Diagram





What I Learned

1. AI is most effective when it explains data, not collects it. I initially considered letting the AI reason about everything directly, but I quickly realized that AWS APIs should remain the source of truth. Having Lambda gather structured resource data first and then passing that context to Amazon Nova resulted in far more accurate and actionable recommendations.
2. Good prompts are just as important as good code. My first prompts generated generic cost-saving advice that could apply to almost any AWS account. The quality improved significantly once I provided structured resource details—such as service type, utilization, age, and state—and instructed Nova to explain why each recommendation mattered, estimate potential savings, and prioritize actions instead of simply listing them.
3. EventBridge Scheduler is ideal for autonomous agents. Unlike traditional cron jobs or manually triggered scripts, EventBridge Scheduler provides a simple, reliable way to run the agent on a fixed schedule with built-in retry capabilities. Once configured, the Cost Guardian runs completely on its own without requiring any dashboards or user interaction.
4. Separating resource discovery from AI reasoning makes the architecture more scalable. Keeping AWS resource scanning and AI analysis as independent steps made the solution easier to maintain and extend. Supporting additional AWS services now only requires updating the discovery layer, while the AI continues to work with the same structured input regardless of the resource type.
5. Least-privilege IAM is essential for autonomous cloud agents. Because the agent automatically scans AWS resources, security had to be built in from the start. Using read-only IAM permissions ensured the agent could safely inspect the environment without the risk of modifying or deleting resources, making it suitable for production environments.
6. The biggest value isn't finding expensive resources—it's explaining what to do next. Most cloud cost tools generate inventories and metrics, leaving users to interpret the results. By using Amazon Nova to summarize findings, estimate potential savings, prioritize recommendations, and explain them in plain English, the agent feels less like a reporting tool and more like a personal FinOps advisor that proactively helps reduce cloud costs.



The Result

I configured the agent, scheduled the nightly scan, and triggered it on demand to validate the entire workflow end to end. The agent discovered AWS resources, analyzed them using Amazon Nova, identified idle and underutilized infrastructure, estimated potential savings, and generated a clear, human-friendly report. Within minutes, I received an email highlighting the most impactful optimization opportunities, explaining why each recommendation mattered and what actions I could safely take.
The most satisfying part of this build wasn't simply identifying unused resources-it was watching the AI transform raw infrastructure data into meaningful operational insights. Instead of presenting a list of EC2 instances or EBS volumes, the agent prioritized recommendations, estimated savings, and explained them in plain English, making cloud cost optimization accessible even without deep FinOps expertise.
The deeper question I wanted to explore with this challenge wasn't "Can an agent scan an AWS account on a schedule?"-that's relatively straightforward. It was whether an autonomous AI agent could continuously monitor a cloud environment, reason over operational data, and proactively deliver recommendations before users even realized they needed them. I believe AWS Cost Guardian demonstrates that autonomous AI agents can move beyond simple automation and become trusted cloud operations assistants.






Link to App and Repo




Final Thoughts

This challenge encouraged me to think differently about cloud operations—not as something that requires constant monitoring, but as something an AI agent can handle proactively. Instead of building another dashboard, I built an autonomous assistant that quietly works in the background, monitors my AWS environment, and delivers meaningful recommendations before I even log into the AWS Console.
The technical building blocks—Amazon Bedrock, Amazon Nova, EventBridge Scheduler, Lambda, DynamoDB, SES, and AWS SAM—are all familiar AWS services. The interesting part was bringing them together to create an AI-powered FinOps agent that doesn't just collect data, but reasons about it, prioritizes what matters, and communicates its findings in a way that's easy to understand. This project reinforced my belief that the next generation of cloud automation won't simply execute tasks—it will continuously observe, analyze, and provide intelligent guidance, helping engineers spend less time investigating and more time building.
Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article