Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tatamiya/gcp-cost-alert
GCP budget alert notification system to Slack using Cloud Functions.
https://github.com/tatamiya/gcp-cost-alert
gcp gcp-cloud-functions slack
Last synced: 17 days ago
JSON representation
GCP budget alert notification system to Slack using Cloud Functions.
- Host: GitHub
- URL: https://github.com/tatamiya/gcp-cost-alert
- Owner: tatamiya
- Created: 2021-05-05T08:04:31.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2021-08-27T11:51:09.000Z (over 3 years ago)
- Last Synced: 2025-01-19T06:31:07.130Z (20 days ago)
- Topics: gcp, gcp-cloud-functions, slack
- Language: Go
- Homepage:
- Size: 90.8 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# gcp-cost-alert
![](img/architecture.png)
![](img/sample_image.png)Send alert to Slack when the cost exceeds the threshold set in Cloud Billing.
This system uses
- Cloud Billing
- Pub/Sub
- Google Cloud Functions
- Slack API## Prerequisites
- [Set budgets and budget alerts](https://cloud.google.com/billing/docs/how-to/budgets)
- in this example, alert thresholds are set as 20%, 50%, and 100% of the budget.
- [Create a Pub/Sub topic](https://cloud.google.com/pubsub/docs/quickstart-console) and register it to the budget alert.
- [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
SLACK_WEBHOOK_URL:
```## Test Commands
### Unit tests
Run unit tests in your local environment.
```
make test
```### All tests (including Slack notification)
In addition to unit tests, you can run integration tests including Slack notification.
```
make test-all
```### Local Run
Run the program locally and send a sample message to Slack.
```
make local-run
```## Deploy Command
In this example, Pub/Sub topic name is `cost-alert`.
You can change topic name and region from Makefile.```
make deploy
```