FinOps Policies as Code for AWS
Declarative YAML policies β live infrastructure evaluation β findings with dollar savings.
Quick Start Β· Why SOFE? Β· Comparison Β· Policies Β· CI/CD
SOFE evaluates declarative YAML policies against live AWS infrastructure and produces actionable findings β idle resources, missing tags, governance violations, and cost savings opportunities.
sofe evaluate --policies ./policies/ --profile productionββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Severity Policy Resource Message
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
π high no-idle-ec2 i-0abc123def avg_cpu = 2.1% (threshold: <5%)
π‘ medium require-cost-tags i-0def456ghi missing: costCenter, owner
π‘ medium no-unattached-ebs vol-789abc 180 days old, 500GB
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Summary: 3 findings | Potential savings: $365.00/mo
Teams today manage cloud costs reactively β they see the bill spike, panic, then scramble to find what changed. Existing tools either alert on total spend (no root cause), scan for security (not cost-focused), or lock you into a vendor.
No tool does: declarative cost + governance policies that evaluate against live infrastructure and produce findings with dollar-amount savings.
# policies/no-idle-production.yaml
apiVersion: sofe/v1
kind: Policy
metadata:
name: no-idle-production
description: "Flag idle EC2 in production (< 5% CPU for 30 days)"
spec:
scope:
environments: [production]
resource_types: [aws.ec2]
rule:
metric: avg_cpu_utilization
period: 30d
operator: "<"
threshold: 5
severity: high
actions:
- type: recommend
suggestion: "Rightsize or terminate"
estimated_savings: calcWrite a policy once. Run it daily. Get findings with savings.
| Role | Why SOFE matters |
|---|---|
| Cloud/DevOps Engineers | Automate governance checks in CI/CD. sofe evaluate --fail-on high blocks deploys that violate cost policies. |
| FinOps Practitioners | Define cost optimization rules as code. Track compliance across accounts. Quantify waste. |
| Platform Engineers | Enforce tagging standards, idle resource cleanup, and architecture best practices at scale. |
| CTOs / Engineering Managers | Visibility into cloud waste without manual audits. |
| AWS Partners / Consultants | Deliver FinOps assessments faster with repeatable, auditable policy evaluations. |
# Install
pip install sofe
# Write your first policy
cat > policies/require-tags.yaml << 'EOF'
apiVersion: sofe/v1
kind: Policy
metadata:
name: require-cost-tags
description: "All resources must have owner and costCenter tags"
spec:
scope:
resource_types: [aws.ec2, aws.rds, aws.s3]
rule:
metric: has_tag:owner
operator: "=="
threshold: 0
severity: medium
actions:
- type: finding
EOF
# Validate
sofe validate --policies ./policies/
# Evaluate against live AWS
sofe evaluate --policies ./policies/ --profile production
# CI/CD mode (exit code 1 if high/critical found)
sofe evaluate --policies ./policies/ --fail-on high
# JSON output for automation
sofe evaluate --policies ./policies/ --format json > findings.jsonβββββββββββββββββββ ββββββββββββββββ ββββββββββββββββββββββββ
β Policy Loader β β Collectors β β Evaluation Engine β
β β β β β β
β Reads YAML ββββββΆβ AWS APIs: ββββββΆβ For each policy: β
β Validates β β EC2, RDS β β match scope β β
β schema β β S3, Lambda β β evaluate condition β β
β β β CloudWatch β β if violated β β
βββββββββββββββββββ ββββββββββββββββ β generate finding β
ββββββββββββ¬ββββββββββββ
β
βββββββββββΌββββββββββ
β Output β
β β’ Table (CLI) β
β β’ JSON (CI/CD) β
β β’ Markdown (PRs) β
ββββββββββββββββββββββ
| Policy | Type | Severity |
|---|---|---|
no-idle-ec2 |
Cost Optimization | high |
no-idle-rds |
Cost Optimization | high |
require-cost-tags |
Governance | medium |
no-oversized-staging |
Cost Optimization | high |
s3-lifecycle-required |
Storage | medium |
s3-encryption-required |
Security/Cost | high |
no-unattached-ebs |
Storage | medium |
no-old-snapshots |
Storage | low |
budget-exceeded |
Budget | critical |
no-public-without-waf |
Security/Cost | high |
| Metric | Source | Resources |
|---|---|---|
avg_cpu_utilization |
CloudWatch (30d avg) | EC2, RDS |
monthly_cost |
Cost Explorer | All |
running_days |
LaunchTime | EC2, RDS |
has_tag:{key} |
Tags API | All |
storage_used_gb |
CloudWatch | S3, EBS |
connections |
CloudWatch | RDS |
invocations |
CloudWatch | Lambda |
- name: FinOps Policy Check
run: |
pip install sofe
sofe evaluate --policies ./policies/ --fail-on high --format json > findings.json| Exit Code | Meaning |
|---|---|
| 0 | No violations (or below --fail-on threshold) |
| 1 | Violations found at or above --fail-on severity |
| Tool | Cost Policies | Live Eval | Savings Calc | CI/CD | Open Source |
|---|---|---|---|---|---|
| SOFE | β | β | β | β | β |
| AWS Budgets | β (alerts only) | β | β | β | β |
| Infracost | π‘ (pre-deploy) | β | β | β | β |
| OPA/Rego | β (security) | β | β | β | β |
| Prowler | β (security only) | β | β | β | β |
| Cloud Custodian | π‘ (not FinOps-first) | β | β | π‘ | β |
SOFE lives in the RUN phase: evaluate live infrastructure against declarative FinOps policies. Produce findings with dollar savings.
PLAN DEPLOY RUN OPTIMIZE
Infracost OPA/Rego β
SOFE β
Spot.io
Checkov Sentinel Cloud Custodian CAST AI
AWS Config
SOFE uses BYaML component types (aws.ec2, aws.s3, etc.) β the same type system used for architecture governance. Policies reference the same types as your architecture definitions, and findings map directly to BYaML components.
| Project | Description |
|---|---|
| sofe-server | REST API server (FastAPI) |
| sofe-cli | Go CLI (19 commands, TUI) |
| sofe-action | GitHub Action |
| byaml-finops-mcp | MCP tools for AI FinOps |
| FinOptix | AI model for FinOps reasoning |
Apache 2.0 β free to use, modify, and distribute.
Built by engineers who got tired of surprise AWS bills.
sofe.dev Β· GitHub Β· finoptix.dev
Write a policy once. Run it daily. Save money.