I Built an AI-Powered AWS Cost Optimizer — Here's How It Works
I'm an AWS consultant. My clients always ask the same question: "Why is my AWS bill so high?" The answer is always the same: idle resources, oversized instances, and services nobody remembered to t...

Source: DEV Community
I'm an AWS consultant. My clients always ask the same question: "Why is my AWS bill so high?" The answer is always the same: idle resources, oversized instances, and services nobody remembered to turn off. So I built a tool to find them automatically. The Architecture Sharktooth connects to a customer's AWS account via a cross-account IAM role — the same pattern used by Datadog, CloudHealth, and AWS's own tools. Customer AWS Account Sharktooth AWS Account ┌─────────────────┐ ┌──────────────────────┐ │ │ │ │ │ IAM Role ◄──────────────── STS AssumeRole │ │ (read-only) │ │ + ExternalId │ │ │ │ │ │ Cost Explorer │ │ Cost Analysis │ │ CloudWatch │────────► │ AI Recommendations │ │ EC2 Describe │ │ Dashboard │ │ RDS Describe │ │ │ └─────────────────┘ └──────────────────────┘ Step 1: Connect (5 minutes) The customer creates a read-only IAM role with this trust policy: { "Version": "2012-10-17", "Statement": [{ "Effect": "Allow", "Principal": { "AWS": "arn:aws:iam::SHARKTOOTH_ACCOUNT:root" },