/gcp-cost-alert

GCP budget alert notification system to Slack using Cloud Functions.

Primary LanguageGo

gcp-cost-alert

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

Enviroment Variables

Enviroment variables to use in GCF runtime are set in env.yaml file.

(sample)

SLACK_WEBHOOK_URL: <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