Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/stangirard/pricy
Export Costs to CSV, HTML, GSheets, Prometheus for AWS & Azure
https://github.com/stangirard/pricy
aws azure cost cost-explorer cost-management finops gsheets html prometheus prometheus-exporter reports
Last synced: 18 days ago
JSON representation
Export Costs to CSV, HTML, GSheets, Prometheus for AWS & Azure
- Host: GitHub
- URL: https://github.com/stangirard/pricy
- Owner: StanGirard
- License: apache-2.0
- Created: 2022-07-27T20:21:31.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-10-23T19:01:07.000Z (22 days ago)
- Last Synced: 2024-10-24T05:12:59.362Z (22 days ago)
- Topics: aws, azure, cost, cost-explorer, cost-management, finops, gsheets, html, prometheus, prometheus-exporter, reports
- Language: Go
- Homepage: https://pkg.go.dev/github.com/stangirard/pricy
- Size: 2.74 MB
- Stars: 27
- Watchers: 2
- Forks: 6
- Open Issues: 12
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Pricy
[![Go Report Card](https://goreportcard.com/badge/github.com/stangirard/pricy)](https://goreportcard.com/report/github.com/stangirard/pricy) [![codecov](https://codecov.io/gh/StanGirard/pricy/branch/main/graph/badge.svg?token=YYBBL7JVCR)](https://codecov.io/gh/StanGirard/pricy)## Install
```bash
brew tap stangirard/tap
brew install pricy
```## Run
```bash
pricy
```If you are using sso for credentials on aws
```bash
pricy --sso
```## Usage
### Cloud Providers
These are the flags required for enabling a cloud provider
- `--aws` - Enable AWS
- `--sso`: Use sso for credentials for `aws`
- `--azure` - Enable Azure
- `subscription`: Azure subscription id you want the report to be generated for### Flags for configuration
There are a couple of parameters that you can use
- `--details`: Show the details of the report with the pricing by service
- `--csv`: Output the report as csv to `reports.csv`
- `--evolution`: Show the evolution of the report as `evolution.csv`
- `--days`: Number of days to look back for
- `--interval`: Date Interval on which the report is generated (Default last 14 days) (Format: YYYY-MM-DD:YYYY-MM-DD)
- `--granularity`: Granularity of the report, can be `daily`, `monthly`
- `--html`: Output the report as html to `pricy.html`
- `--prometheus`: Outputs as prometheus metrics on `http://localhost:2112/metrics` that can be scraped by prometheus
- `--gsheets`: Outputs the report to a google sheets spreadsheet## Example
### Generate a Google Spreadsheet
You need to export the variable `GOOGLE_APPLICATION_CREDENTIALS` to the path of your json file which contains your OAuth2 credentials.
In oder to get the credentials, you follow this guide:
- [Google Cloud Platform](https://developers.google.com/sheets/api/quickstart/go)
- Activate Sheets API
- Create a credentials for Oauth2 for Desktop Application```bash
export GOOGLE_APPLICATION_CREDENTIALS="/path/to/credentials.json"
``````bash
pricy --aws --sso --csv --gsheet --days 30
```
### HTML Report Generation
```bash
pricy --aws --sso --days 150 --granularity monthly --html
```Generates a report for the price starting a 150 days ago
### Prometheus Metrics
```bash
pricy --aws --sso --prometheus
```Generates the prometheus metrics for the price updating every 8 hours