Skip to main content

SOFE Server

REST API for the SOFE FinOps Engine
Multi-tenant evaluation platform with catalog, history, and alerts.

Quick Start · Endpoints · Usage · Ecosystem

PyPI Python License FastAPI PRs


Wraps the SOFE Python engine in a FastAPI application, enabling HTTP-based evaluations.

pip install sofe sofe-server
sofe-server
# → http://localhost:8080

Quick Start

# Install
pip install sofe sofe-server

# Start server
sofe-server

# Evaluate your AWS account
curl -X POST http://localhost:8080/evaluate \
  -H "Content-Type: application/json" \
  -d '{"profile": "default"}'

Or use the Go CLI:

sofe serve    # starts sofe-server in background
sofe evaluate # calls localhost:8080/evaluate

Endpoints

Method Path Description
GET /health Health check
POST /evaluate Evaluate AWS account against policies
POST /validate Validate an Architecture Graph (BYaML v0.4 JSON)
GET /policies List all loaded policies
GET /collectors List available collectors
GET /metrics List metrics per collector
POST /connect/test Test STS AssumeRole connection

Usage

Evaluate a different AWS account (cross-account role)

Pass the role to assume and its ExternalId. The server calls sts:AssumeRole and runs every collector with those temporary credentials, so the account behind the role is the one that gets evaluated:

curl -X POST http://localhost:8080/evaluate \
  -H "Content-Type: application/json" \
  -d '{
    "role_arn": "arn:aws:iam::123456789012:role/sofe-read-only",
    "external_id": "your-external-id"
  }'
Field Notes
role_arn IAM role ARN to assume. Takes precedence over profile.
external_id Required with role_arn (2-1224 chars: letters, digits, +=,.@:/-).

The response says what was actually read: account_id, evaluated_via (assumed_role | profile | default_credentials) and evaluated_role_arn.

Status Meaning
400 Missing/invalid role_arn or external_id, or a role is required (see below). No AWS call is made.
403 STS denied the assume: the role does not exist in that account or its trust policy ExternalId does not match.
502 STS failed for another reason.
501 The installed sofe engine is too old for role-based evaluation (upgrade sofe).

The ExternalId is never echoed in responses or logs.

Hosted deployments: require a role

By default, a request without role_arn evaluates the account of the server's own credentials (or profile) — the right behavior for self-hosted use. A hosted server that evaluates other people's accounts must never do that. Set:

SOFE_REQUIRE_ROLE=true

and any /evaluate request that does not name a role is rejected with 400 before any AWS API is called.

List policies

curl http://localhost:8080/policies

Docker

docker run -p 8080:8080 -v ~/.aws:/root/.aws:ro \
  ghcr.io/breakingthecloud/sofe-community:latest

Architecture

sofe-server (this repo)
    │
    │ imports
    ▼
sofe/ (engine — pip install sofe)
    │
    │ boto3
    ▼
Your AWS Account (read-only)

sofe-server is a thin wrapper — all policy evaluation logic lives in the sofe engine.

Requirements

  • Python 3.11+
  • sofe >= 0.2.0 (engine)
  • AWS credentials (profile or role)

Development

git clone https://github.com/breakingthecloud/sofe-server.git
cd sofe-server
uv venv && source .venv/bin/activate
uv pip install -e ".[dev]" -e ../sofe/
uvicorn sofe_server.app:app --reload --port 8080

# Tests (no AWS needed: STS and the engine are faked)
pytest

Ecosystem

Project Description
sofe Python engine (collectors + policies)
sofe-cli Go CLI (19 commands, TUI)
sofe-action GitHub Action for CI/CD
platform.sofe.dev SaaS dashboard (free tier)
sofe.dev/docs Documentation (26 pages)

License

Apache 2.0 — see LICENSE.


sofe.dev · Engine · finoptix.dev

Metadata

Release files for sofe-server 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sofe-server 0.3.0
File Size Uploaded Provenance Actions
sofe_server-0.3.0.tar.gz 19.6 kB Without provenance Details for sofe_server-0.3.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for sofe-server 0.3.0
File Interpreter ABI Platform Actions
sofe_server-0.3.0-py3-none-any.whl Python 3 none any Details for sofe_server-0.3.0-py3-none-any.whl

Total release size: 34.3 kB

Release files / sofe_server-0.3.0.tar.gz

Download URL sofe_server-0.3.0.tar.gz
Size 19.6 kB
Tags Source
SHA-256 checksum
How to use checksums
bdb84cc3be04fd9c39a320861107e8244940e7449354d72c8ee9447c7b2ad2da
BLAKE2b-256 checksum
How to use checksums
dbc0691ad310b5878ec74941675687423b8de742067d58e39d68f8da0f6e3127
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.8.17

Release files / sofe_server-0.3.0-py3-none-any.whl

Download URL sofe_server-0.3.0-py3-none-any.whl
Size 14.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
163f915e14373f46d1a183448d8e81cbeb7b85cb7891fedfc7769cb880ed8902
BLAKE2b-256 checksum
How to use checksums
94a5db185ea5d37b29bc9f6129366b84df49dcdc855de0ce4d39e36be15ca9ac
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.8.17

Security for sofe-server 0.3.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page