https://github.com/deepraj1729/gcp-cloud-billing-api
Cloud Billing - Cost Monitoring and Alerting API for Google Cloud (Billing Exports)
https://github.com/deepraj1729/gcp-cloud-billing-api
bigquery fastapi gcp python redis
Last synced: 2 months ago
JSON representation
Cloud Billing - Cost Monitoring and Alerting API for Google Cloud (Billing Exports)
- Host: GitHub
- URL: https://github.com/deepraj1729/gcp-cloud-billing-api
- Owner: deepraj1729
- Created: 2024-01-10T19:14:08.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-01-10T20:44:40.000Z (over 2 years ago)
- Last Synced: 2025-01-11T06:45:44.542Z (over 1 year ago)
- Topics: bigquery, fastapi, gcp, python, redis
- Language: Python
- Homepage:
- Size: 289 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# gcp-cloud-billing
Cloud Billing - Cost Monitoring and Alerting API for Google Cloud (Billing Exports)

## Use-Case:
The project connects to Google Cloud BigQuery having Billing Export to Analyse, Monitor and Alerts for Cloud Cost and caches the results in Redis.
## Setup:
To setup the project locally, use Docker with docker-compose:
docker-compose up -d
The server will be up and running at localhost:8080/
## Authentication:
Provide the environment variables defined in the `docker-compose.yml`. To authenticate to Google Cloud, you will need a Service Account JSON mounted on the container having path set to `GOOGLE_APPLICATION_CREDENTIALS` environment variable.
## Caching and Rate Limiting:
Caching for BigQuery queries are done via Redis with a provided TTL expiry time.
The rate limiter is set that maintains a LRU cache in memory that creates mapping between user IP and requests hit per minute.
## Documentation:
The documentation for the API will be available at `/docs` route serving via `Swagger`. This is thanks to the FastAPI integration with Swagger UI.

## References:
The references for this project are mentioned below:
- [GCP Billing Export to BigQuery](https://cloud.google.com/billing/docs/how-to/export-data-bigquery)
- [FastAPI Documentation](https://fastapi.tiangolo.com/)
- [Docker Documentation](https://docs.docker.com/)
- [Redis Documentation](https://redis.io/docs/)