Uma CLI para visualizar e auditar custos na AWS (FinOps), com suporte a múltiplos perfis, combinação por conta, exportação de relatórios (CSV/JSON/PDF), análise de tendências e auditoria de otimizações (NAT Gateways caros, LBs ociosos, Volumes/EIPs sem uso, recursos sem tags etc.).
--combine--tag)--time-range)--trend--audit):Clone o repositório:
git clone https://github.com/diillson/aws-finops-dashboard-go.git
cd aws-finops-dashboard-go
````
Build básico:
```bash
go build -o bin/aws-finops ./cmd/aws-finops
Executável:
./bin/aws-finops --help
Linux/macOS:
go build -ldflags "-s -w \
-X github.com/diillson/aws-finops-dashboard-go/pkg/version.Version=1.2.0 \
-X github.com/diillson/aws-finops-dashboard-go/pkg/version.Commit=$(git rev-parse --short HEAD) \
-X github.com/diillson/aws-finops-dashboard-go/pkg/version.BuildTime=$(date -u +%Y-%m-%dT%H:%M:%SZ)" \
-o bin/aws-finops ./cmd/aws-finops
Windows (PowerShell):
$commit = git rev-parse --short HEAD
$buildTime = (Get-Date).ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ssZ")
go build -ldflags "-s -w `
-X github.com/diillson/aws-finops-dashboard-go/pkg/version.Version=1.2.3 `
-X github.com/diillson/aws-finops-dashboard-go/pkg/version.Commit=$commit `
-X github.com/diillson/aws-finops-dashboard-go/pkg/version.BuildTime=$buildTime" `
-o bin/aws-finops ./cmd/aws-finops
Ao iniciar, verá algo como:
AWS FinOps Dashboard CLI (v1.2.0 (commit: abc1234, built at: 2025-10-23T10:20:30Z))
Sem -ldflags, o padrão é:
AWS FinOps Dashboard CLI (v0.0.0-dev (development))
O projeto inclui um Makefile para simplificar o build.
Uso:
make build
./bin/aws-finops --version
aws-finops --help
aws-finops --version
aws-finops -p my-prod
aws-finops --all
aws-finops --all --combine
aws-finops -p prod -g Environment=Production -n finops-report -y csv -y pdf -d ./reports
aws-finops -p prod --trend
aws-finops --all --audit -n audit-$(date +%Y%m%d) -y pdf -d ./audits
-C, --config-file string Caminho do arquivo de configuração
-p, --profiles strings Perfis AWS (separados por vírgula)
-r, --regions strings Regiões AWS
-a, --all Usa todos os perfis disponíveis
-c, --combine Combina perfis da mesma conta
-n, --report-name string Nome base do relatório
-y, --report-type strings Tipos: csv, json, pdf
-d, --dir string Diretório de saída
-t, --time-range int Intervalo em dias (padrão: mês corrente)
-g, --tag strings Filtro por tag (ex: Team=DevOps)
--trend Análise de tendência (6 meses)
--audit Auditoria de otimização
--breakdown-costs Detalhamento de custos (usage-type)
--version Mostra a versão
--help Ajuda
type Config struct {
Profiles []string `json:"profiles" yaml:"profiles" toml:"profiles"`
Regions []string `json:"regions" yaml:"regions" toml:"regions"`
Combine bool `json:"combine" yaml:"combine" toml:"combine"`
ReportName string `json:"report_name" yaml:"report_name" toml:"report_name"`
ReportType []string `json:"report_type" yaml:"report_type" toml:"report_type"`
Dir string `json:"dir" yaml:"dir" toml:"dir"`
TimeRange int `json:"time_range" yaml:"time_range" toml:"time_range"`
Tag []string `json:"tag" yaml:"tag" toml:"tag"`
Audit bool `json:"audit" yaml:"audit" toml:"audit"`
Trend bool `json:"trend" yaml:"trend" toml:"trend"`
All bool `json:"all" yaml:"all" toml:"all"`
}
TOML
profiles = ["production", "development", "data-warehouse"]
regions = ["us-east-1", "us-west-2", "eu-central-1"]
combine = true
report_name = "aws-finops-monthly"
report_type = ["csv", "pdf"]
dir = "/home/user/reports/aws"
time_range = 30
tag = ["Environment=Production", "Department=IT"]
audit = false
trend = false
YAML
profiles:
- production
- development
- data-warehouse
regions:
- us-east-1
- us-west-2
- eu-central-1
combine: true
report_name: aws-finops-monthly
report_type: [csv, pdf]
dir: /home/user/reports/aws
time_range: 30
tag: ["Environment=Production", "Department=IT"]
audit: false
trend: false
JSON
{
"profiles": ["production", "development", "data-warehouse"],
"regions": ["us-east-1", "us-west-2", "eu-central-1"],
"combine": true,
"report_name": "aws-finops-monthly",
"report_type": ["csv", "pdf"],
"dir": "/home/user/reports/aws",
"time_range": 30,
"tag": ["Environment=Production", "Department=IT"],
"audit": false,
"trend": false
}
aws-finops --config-file /path/config.yaml
Flags de linha de comando sobrescrevem as do arquivo.
aws-finops --all --combine -n monthly-costs -y csv -y pdf -d ./reports
aws-finops -p prod -p staging --audit -r us-east-1 -r eu-west-1 -n audit-jan -y pdf -d ./audits
aws-finops -p prod --trend -g Department=Engineering -t 180
aws-finops -p prod --breakdown-costs -n finops-dt -y json -y pdf -d ./reports
aws-finops -C config.yaml --report-name override --trend
csv, json, pdfDashboard:
Auditoria:
Colunas: Conta, Budget, NAT Gateway, EBS, EC2, LBs, Tags
aws-finops -p prod -n report-name -y csv -y json -y pdf -d ./out
Arquitetura Hexagonal (Ports & Adapters):
Adapters:
Principais componentes:
cmd/aws-finops/main.gointernal/adapter/driving/cliinternal/application/usecaseinternal/adapter/driven/awspkg/consolepkg/versionFluxo:
-dev)Dashboard e tendência:
ce:GetCostAndUsage
budgets:DescribeBudgets
ec2:DescribeInstances
ec2:DescribeRegions
sts:GetCallerIdentity
Auditoria:
ec2:DescribeVolumes
ec2:DescribeAddresses
rds:DescribeDBInstances
lambda:ListFunctions
elasticloadbalancing:DescribeLoadBalancers
elasticloadbalancing:DescribeTargetGroups
elasticloadbalancing:DescribeTargetHealth
No AWS profiles found: configure com aws configure --profile <nome>credential validation failed: renove STS/SSOAccessDenied: ajuste políticas IAM-ldflags no buildpterm.MultiPrinter--combine reduz chamadas redundantesDashboard

Tendência

Auditoria

Inspirado em:
Licença: MIT
Port Go e melhorias:
Contribuições são bem-vindas — abra issues ou PRs com sugestões 🚀
$ claude mcp add aws-finops-dashboard-go \
-- python -m otcore.mcp_server <graph>