{"slug": "using-crewai-and-amazon-bedrock-to-cut-my-aws-bill-by-40-worked-but-it-s-not-a", "title": "Using CrewAI and Amazon Bedrock to cut my AWS bill by 40% worked, but it's not a magic", "summary": "A developer reports cutting an AWS bill by 40% using CrewAI and Amazon Bedrock, finding $125/month in savings on a $300 bill by killing 2023 snapshots and migrating gp2 to gp3 volumes. The multi-agent setup with Scanner, Optimizer, and Report Writer roles took about 4 hours to build and runs in roughly 60 seconds, but the author cautions it is not a magic solution, citing IAM permission issues, token overflow, and the cost of running agents.", "body_md": "# Using CrewAI and Amazon Bedrock to cut my AWS bill by 40% worked, but it's not a magic\n\n## Why Trusted Advisor and Compute Optimizer aren't enough\n\nI'm skeptical of \"all-in-one\" dashboards because they usually miss the granular stuff. AWS Trusted Advisor's free tier only hits 7 checks, often ignoring gp2 to gp3 migration opportunities or specific orphaned snapshots. Compute Optimizer is too narrow, focusing on EC2 and Lambda while ignoring the \"silent killers\" like unattached Elastic IPs that burn $3.60/month each. I needed a system that didn't just show me a graph of spending but gave me a specific list of resource IDs to terminate.\n\n## The multi-agent architecture\n\nI initially tried a single-prompt approach, but it was a disaster. The LLM started hallucinating resource IDs because it was trying to handle the API data and the analysis simultaneously. Splitting the logic into three distinct roles solved the hallucination problem.\n\n- **The Scanner:** Uses boto3 to pull raw facts on EC2, EBS, EIPs, and S3. It does zero reasoning; it just fetches data.\n- **The Optimizer:** Takes the raw list and flags the waste. It looks for volumes without attachments and compares current instance types against potential Reserved Instance savings.\n- **The Report Writer:** Converts the technical findings into a markdown list sorted by dollar impact and risk level.\n\n## Implementation details and the custom tool\n\nThe core of this is a custom tool that wraps boto3. Without a strictly defined tool, the agents try to \"guess\" what's in your account.\n\n``` python\nfrom crewai import Agent, Task, Crew, Process\nfrom crewai.tools import BaseTool\nimport boto3\n\nclass AWSScannerTool(BaseTool):\n    name: str = \"aws_resource_scanner\"\n    description: str = \"Scans AWS account for idle resources and cost leaks.\"\n\n    def _run(self, query: str):\n        ec2 = boto3.client('ec2')\n        # Logic to fetch unattached volumes and idle EIPs\n        volumes = ec2.describe_volumes(Filters=[{'Name': 'status', 'Values': ['available']}])\n        return volumes['Volumes']\n\n# Configure the LLM via Bedrock\nfrom crewai import LLM\nbedrock_llm = LLM(model=\"bedrock/amazon.nova-pro-v1:0\")\n```\n\n## Where this broke and the \"gotchas\"\n\nIt isn't all smooth sailing. Here is what actually happened during the build:\n\n- **IAM Permission Hell:** If you don't attach the correct IAM role to the EC2 instance running the crew, the Scanner agent will fail with`ClientError: An error occurred (UnauthorizedOperation)` . You need a policy that allows`describe` calls across all relevant services.\n- **Token Overflow:** If you have hundreds of resources, the raw JSON from boto3 will blow out your context window. I had to implement a filtering layer in the`AWSScannerTool` to only send \"available\" or \"idle\" resources to the Optimizer, rather than the entire inventory.\n- **Cost of Running:** While it saves money, running these agents isn't free. Depending on the volume of resources scanned, the Bedrock tokens can add up if you cron this hourly. Weekly is the sweet spot.\n\n## Performance breakdown\n\n- **Setup time:** About 4 hours to get the boto3 tools stable.\n- **Execution time:** Roughly 60 seconds to scan and report.\n- **Actual Savings:** $125/month found in a $300 bill (mostly by killing snapshots from 2023 and moving gp2 to gp3).\n\n[Next AlphaGenome Atlas is mapping 3 billion base pairs to predict DNA →](/en/threads/9040/)\n\n[these real-world AI monetization case studies](https://tanyan888.com/), with plenty of directly applicable cases.\n\n## All Replies （4）\n\nDoubtful. I’ve seen too many \"automated\" tools hallucinate costs. Does this actually integrate with CloudHealth or just a custom script?\n\nI want to try this tonight. Did you use the Claude 3.5 Sonnet model or something cheaper for the agent logic?\n\nI'm curious if you factored in the data transfer costs. I'm seeing a weird spike with Terraform...", "url": "https://wpnews.pro/news/using-crewai-and-amazon-bedrock-to-cut-my-aws-bill-by-40-worked-but-it-s-not-a", "canonical_source": "https://promptcube3.com/en/threads/9104/", "published_at": "2026-09-09 16:33:37+00:00", "updated_at": "2026-09-09 16:51:15.056087+00:00", "lang": "en", "topics": ["artificial-intelligence", "ai-agents", "ai-tools", "ai-infrastructure"], "entities": ["CrewAI", "Amazon Bedrock", "AWS Trusted Advisor", "Compute Optimizer", "boto3", "EC2", "EBS", "S3"], "alternates": {"html": "https://wpnews.pro/news/using-crewai-and-amazon-bedrock-to-cut-my-aws-bill-by-40-worked-but-it-s-not-a", "markdown": "https://wpnews.pro/news/using-crewai-and-amazon-bedrock-to-cut-my-aws-bill-by-40-worked-but-it-s-not-a.md", "text": "https://wpnews.pro/news/using-crewai-and-amazon-bedrock-to-cut-my-aws-bill-by-40-worked-but-it-s-not-a.txt", "jsonld": "https://wpnews.pro/news/using-crewai-and-amazon-bedrock-to-cut-my-aws-bill-by-40-worked-but-it-s-not-a.jsonld"}}