Skip to main content

A Python CLI tool for exporting cost reports over Multi-providers AWS/Azure.

Project description

Welcome to eraXplor

Cost Export Tool for automated cost reporting and analysis.

eraXplor is an automated cost reporting tool designed for assist DevOps and FinOps teams fetching and sorting AWS and Azure Cost Explorer. it extracts detailed cost data by calling natively cloud provider APIs directly and Transform result into CSV file. eraXplor gives you the ability to sort the cost with wide range of options:

  • For AWS you able to sort cost by Account, Service, Usage Type or even By Purchase Type; as well as format and separate the result by Monthly or Daily.
  • For Azure you able to sort cost by Subscription, as well as format and separate the result by Monthly or Daily.

Key Features

  • Cloud provider Separated tools: Separated tool for each cloud provider (e.g. AWS and Azure) avoiding complexity.
  • Flexible Date Ranges: Custom start/end dates with validation.
  • Multi-Profile Support: Works with all configured AWS profiles.
  • Multi-Subscription Support: Works to list all configured Azure subscriptions.
  • Enhanced Grouping Options: Advanced grouping for AWS (Account+Service, Account+Purchase Type, Account+Usage Type) and Azure (Subscriptions, Services, Resource groups).
  • REST API Support: FastAPI-based REST API for programmatic cost data access with JSON responses.
  • CSV Export: Ready-to-analyze reports in CSV format.
  • Cross-platform CLI Interface: Simple terminal-based command-line, and Cross OS platform.
  • Documentation Ready: Well explained documentations assist you kick start rapidly.
  • Open-Source: the tool is open-source under Apache 2.0 license, which enables your to enhance it for your purpose.

Table Of Contents

Quickly find what you're looking for depending on your use case by looking at the different pages.

AWS

  1. Overview
  2. Tutorials
  3. How-To Guides
  4. Concepts & Explanation
  5. Refrence
  6. API
  7. API Refrence

Azure

  1. Overview
  2. Tutorials
  3. How-To Guides
  4. Concepts & Explanation
  5. Refrence
  6. API
  7. API Refrence

How-To Guides

Check installed Python version

  • Ensure you Python version is >= 3.12.3 by:
python --version

# Consider update Python version if less than 3

Install eraXplor

  • Install eraXplor too by:
pip install eraXplor

REST API

eraXplor includes a FastAPI-based REST API that allows you to programmatically export cost data from both AWS and Azure.

Start the API Server

# From the repository root
uvicorn api.main:app --app-dir src --reload --host 0.0.0.0 --port 8000

The API will be available at http://localhost:8000 Interactive API test Swagger UI under http://localhost:8000/docs

API Endpoints

AWS FOCUS Workflow

POST /aws/focus/run

curl -X POST "http://localhost:8000/aws/focus/run" \
  -H "Content-Type: application/json" \
  -d '{
    "command": "configure",
    "profile": "default",
    "region": "us-east-1",
    "stack_name": "CID-DataExports-Source",
    "granularity": "MONTHLY"
  }'

GET /aws/focus/run

curl "http://localhost:8000/aws/focus/run?command=download&profile=default&region=us-east-1&stack_name=CID-DataExports-Source"

Azure Cost Export

POST /azure/cost/export

curl -X POST "http://localhost:8000/azure/cost/export" \
  -H "Content-Type: application/json" \
  -d '{
    "start_date": "2025-01-01",
    "end_date": "2025-03-30",
    "granularity": "Monthly",
    "group_by": "subscription"
  }'

GET /azure/cost/export

curl "http://localhost:8000/azure/cost/export?start_date=2025-01-01&end_date=2025-03-30&granularity=Monthly&group_by=subscription"

API Response Format

{
  "success": true,
  "message": "AWS cost data exported successfully",
  "total_records": 5,
  "cost_data": [...],
  "request_parameters": {
    "start_date": "2025-01-01",
    "end_date": "2025-03-30",
    "profile": "default",
    "group_by": "LINKED_ACCOUNT",
    "granularity": "MONTHLY"
  }
}

API Documentation (Swagger UI)

Visit http://localhost:8000/docs for interactive API documentation.


How-To-Guide - AWS

AWS profile configuration

  • Install AWS CLI - Command line tool.
  • Create an AWS AMI user then extract Access ID & key.
  • Configure AWS CLI profile by:
aws configure <--profile [PROFILE_NAME]>
# ensure you set a defalut region.

How-To use - AWS

eraXplor-aws now supports two separate commands for AWS FOCUS workflow.

# Step 1: Configure data export stack
eraXplor-aws --command configure --profile default --region us-east-1 --stack-name CID-DataExports-Source --granularity MONTHLY

# Step 2: Download parquet files later (after export data is available)
eraXplor-aws --command download --profile default --region us-east-1 --stack-name CID-DataExports-Source

Argument Reference - AWS

  • --command, -c: (Not Required) Default value is configure. Available options: configure, download
  • --profile, -p: (Not Required) Default value is default.
  • --region, -r: (Not Required) Default value is us-east-1.
  • --stack-name, -s: (Not Required) Default value is CID-DataExports-Source.
  • --granularity, -g: (Not Required) Default value is MONTHLY. Available options: HOURLY, DAILY, MONTHLY

Example Usage - AWS

eraXplor-aws

How-To-Guide - Azure

Azure CLI Authentication

  • Install Azure CLI - Command line tool by specifing your attended OS.
  • ensure your account have sufficient permission as Billing Reader or Usage Billing Contributor to manage Azure billing.
  • Check installed package by:
az --version
  • Authenticate using your Azure account:
az login

This will open the portal in your default browser to authenticate.

How-To use - Azure

eraXplor-azure have multiple arguments set with a default values -explained below-, Adjsut these arguments as required.

eraXplor_az <--start-date [yyyy,MM,DD]> <--end-date [yyyy,MM,DD]> \
<--subscription_id [SUBSCRIPTION_ID]> \
<--group-by [subscription | ServiceName | ResourceGroupName]> \
<--granularity [DAILY | MONTHLY]> \
<--output [FILE_NAME.CSV]>

Argument Reference - Azure

  • --start-date or -s: (Optional) Default value set as three months before.
  • --end-date or -e: (Optional) Default value set as Today date.
  • --group-by or -g: (Optional) Default value set as subscription. Available options: (subscription, ServiceName, ResourceGroupName)
  • --out or -o: (Optional) Default value set as az_cost_report.csv.
  • --granularity or -G: (Optional) Default value set as MONTHLY. The available options are (MONTHLY, DAILY)

Azure Commands

Example Usage - Azure

eraXplor-azure

For Windows/PowerShell users restart your terminal, and you may need to use the following command:

python -m eraXplor-aws

# Or
python -m eraXplor-azure

# to avoid using this command, apend the eraXplor to your paths.
# Normaly its under: C:\Users\<YourUser>\AppData\Local\Programs\Python\Python<version>\Scripts\

About the Author

👋Show/Hide Author Details👋

Mohamed eraki
Cloud & DevOps Consultant

Email
LinkedIn
Blog

Project Philosophy

"I built eraXplor to solve real-world cloud cost visibility challenges — the same pain points I encounter daily in enterprise environments. This tool embodies my belief that financial accountability should be accessible to every technical team."

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

eraxplor-4.0.1.tar.gz (33.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

eraxplor-4.0.1-py3-none-any.whl (35.7 kB view details)

Uploaded Python 3

File details

Details for the file eraxplor-4.0.1.tar.gz.

File metadata

  • Download URL: eraxplor-4.0.1.tar.gz
  • Upload date:
  • Size: 33.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for eraxplor-4.0.1.tar.gz
Algorithm Hash digest
SHA256 f72c77f6e18c84d00d70c73a67a7d81a71a30d8749c0f28f796fbd4de1e4e1a3
MD5 02d6894a41ea4c5ea8d39e851e06a5f0
BLAKE2b-256 b97c7bc6e9ff1d49ae304673cd1b62c82dfdb19ba67f8746111dc87a7a456422

See more details on using hashes here.

File details

Details for the file eraxplor-4.0.1-py3-none-any.whl.

File metadata

  • Download URL: eraxplor-4.0.1-py3-none-any.whl
  • Upload date:
  • Size: 35.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for eraxplor-4.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 060ebe39afcc1906dbd5d4a48bcf843c00c5ecaae9681ad29f6e4736b1513489
MD5 8983cbfaa908fdd0f824860d725ddf4a
BLAKE2b-256 10e13afcf76de49a09daaa27ad1aac245051af607ef8b86684313b1f18d2e38e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page