GithubHelp home page GithubHelp logo

hughcar389 / google-cloud-platform-killswitch Goto Github PK

View Code? Open in Web Editor NEW

This project forked from dataslayermedia/google-cloud-platform-killswitch

0.0 0.0 0.0 163 KB

Limit the total costs which can be incurred by your Google Cloud Platform account.

JavaScript 100.00%

google-cloud-platform-killswitch's Introduction

Google-Cloud-Platform-Killswitch

Add a limit on billing costs for your GCP account.

Video Tutorial

Details from Google

https://cloud.google.com/billing/docs/how-to/notify

Enable Budget Notifications

Navigate to Billing Navigate to Budgets & alerts CREATE BUDGET

Listen to Notifications via Cloud Function

Create a cloud function with trigger type Pub/Sub Use the "index.js" and "package.json" scripts. Swap out your project ID in the index.js file. This script disable billing on the project which will render the services no longer working and stop any incremental costs from accruing.

Enable Cloud Billing API

Service Account Upgrade

Provide Billing Administration access to the Cloud Function Service Account

Publish Sub/Pub Message

https://console.cloud.google.com/cloudpubsub/topic/detail/budget-notifications?project=macgyver-services-production

{
    "budgetDisplayName": "name-of-budget",
    "alertThresholdExceeded": 1.0,
    "costAmount": 100.01,
    "costIntervalStart": "2019-01-01T00:00:00Z",
    "budgetAmount": 100.00,
    "budgetAmountType": "SPECIFIED_AMOUNT",
    "currencyCode": "USD"
}

Publish Test Message

Validate that Billing is Disabled

https://console.cloud.google.com/billing/linkedaccount?project=macgyver-services-production

Disabled Billing

google-cloud-platform-killswitch's People

Contributors

dataslayermedia avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.