Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tatamiya/gcp-cost-notification
Daily notification of GCP costs to Slack
https://github.com/tatamiya/gcp-cost-notification
gcp gcp-cloud-functions slack
Last synced: 10 days ago
JSON representation
Daily notification of GCP costs to Slack
- Host: GitHub
- URL: https://github.com/tatamiya/gcp-cost-notification
- Owner: tatamiya
- Created: 2021-05-03T11:38:26.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2021-09-03T12:35:40.000Z (over 3 years ago)
- Last Synced: 2025-01-19T06:31:07.156Z (12 days ago)
- Topics: gcp, gcp-cloud-functions, slack
- Language: Go
- Homepage:
- Size: 219 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# gcp-cost-notification
Send notification to Slack on GCP costs.
![](images/architecture.png)
![](images/sample_image.png)
This system uses
- Cloud Billing
- BigQuery
- Cloud Scheduler
- Pub/Sub
- Google Cloud Functions
- Slack API## Prerequisites
- [Export Cloud Billing data to BigQuery](https://cloud.google.com/billing/docs/how-to/export-data-bigquery-setup)
- [Create Pub/Sub topic](https://cloud.google.com/pubsub/docs/quickstart-console)
- [Set Cloud Scheduler](https://cloud.google.com/scheduler/docs/quickstart)
- [Make Slack app and get Incoming Webhook URI](https://api.slack.com/messaging/webhooks)## Enviroment Variables
Enviroment variables to use in GCF runtime are set in `env.yaml` file.
(sample)
```yaml
GCP_PROJECT:
DATASET_NAME:
TABLE_NAME:
SLACK_WEBHOOK_URL:
FILE_DIRECTORY: "serverless_function_source_code/" # this should be fixed
TIMEZONE:
```## Test Commands
Before executing test commands, environment variables must be set in `.env` file.
### Unit Tests (short mode)
Execute unit tests which have no interaction with outer services (BigQuery and Slack).
```sh
make test
```### All Tests (including BigQuery and Slack communication)
```sh
make test-all
```### Local Runner
Run the whole process from your local environment.
```sh
make local-run
```## Deploy Command
Set `REGION` and `TRIGGER_TOPIC` variables in Makefile and execute this command:
```sh
make deploy
```