Git Product home page Git Product logo

aws-cdk-billing-alarm's Introduction

aws-cdk-billing-alarm

Build status NPM version PyPI version Mentioned in Awesome CDK

A CDK construct that sets up email notification for when you exceed a given AWS estimated charges amount.

Create this construct in any stack you find appropriate with only a few lines. This construct is an implementation of the manual setup described on AWS Estimated Charges Monitoring.

Get Started

Pre-Requisites

IMPORTANT! Only complete Step 1: Enable Billing Alerts of the following documentation link. This construct will take care of creating the rest of the resources for you.

You must first enable billing alerts from the AWS Console as per documentation.

Billing alerts will allow your AWS account to start collecting billing metrics (EstimatedCharges) on a periodic 6-hour basis.

Installation

npm install --save aws-cdk-billing-alarm
pip install aws-cdk-billing-alarm

Usage

import { Stack, StackProps } from 'aws-cdk-lib';
import { Construct } from 'constructs';
import { BillingAlarm } from 'aws-cdk-billing-alarm';

class CdkStack extends Stack {
  constructor(scope: Construct, id: string, props?: StackProps) {
    super(scope, id, props);

    // Create an alarm that emails `[email protected]`
    // if estimated charges exceed 50 USD
    new BillingAlarm(this, 'AWSAccountBillingAlarm', {
      monthlyThreshold: 50,
      emails: ['[email protected]'],
    });
  }
}

Post-Deployment

Confirm the subscription to the newly created topic for the emails you specified as endpoints in BillingAlarmProps. You can do so by clicking on the SubscribeURL of the JSON email you received.

Note: If you did not receive the email, you can fire a Request confirmation for the subscription from the AWS SNS Console.

Limitations

aws-cdk-billing-alarm's People

Contributors

alvyn279 avatar dependabot[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

aws-cdk-billing-alarm's Issues

Set up Github Actions

Context

It would be good to build, test, and potentially release the application from GitHub Actions.

Tasks

  • Set up build, linter and test workflow (on any PR or push to main)
  • Publish can be done with jsii-publish

Alternatives

N/A

Notes

This repository will be subject to max of 3000 build minutes while it is private.

Support multiple emails

Context

It would be nice to notify more than one endpoint (email). This would be a breaking change.

Tasks

  • API change for BillingAlarmProps from email to emails: Array<string>

Alternatives

Would it be better to support more than just EmailSubscription ?

Notes

N/A

Example has a bad reference to `stack`

Bug Description

The README code sample is wrong given that the construct is written in a stack.

new BillingAlarm(stack, 'AWSAccountBillingAlarm', {
      monthlyThreshold: 50,
      emails: ['[email protected]'],
    });

should be

new BillingAlarm(this, 'AWSAccountBillingAlarm', {
      monthlyThreshold: 50,
      emails: ['[email protected]'],
    });

Reproduction Steps

Look at README

Support Python construct

Context

It would be great if this construct would also be available in Python

Tasks

  • Look into a jsii integration where TypeScript Construct code would be compiled and served as a ready-to-use Python module

Alternatives

N/A

Notes

N/A

Rename release tags

Bug Description

The latest release name does not need the 'Release ' prefix.
image

  • We just need to modify publish.yml workflow that takes care of naming this entity.
  • Maybe even take out the Pull requests header before the list of pull requests.

Reproduction Steps

Look at the repo's landing page.

Expected Behaviour

We just want the version number

Additional Context

N/A

README supports dynamic documentation

Context

jsii has a really cool feature where the example Typescript code in README is transformed into the target language at package/publish time. This mean NPM and PyPi will respectively show working TS and Python code examples.

We need to play around that to ensure coherent installation steps and code samples are shown in the packages homepages.

Tasks

  • Remove Typescript header
  • Have both npm and pip install
  • GitHub README will still show default README, so we need to include a statement for specific python example

Alternatives

Have both TS and Python install/code samples. Will clutter README.

Notes

N/A

Prepare for V1 release

Context

There is a lot of setup needed before releasing this construct library as an NPM package.

Tasks

  • Build system:
  • README:
    • Pre-reqs and post installation
    • Working example
  • Publish #2 on beta
  • Function test

Alternatives

N/A

Notes

  • Should probably function test beta in TS and Python when published to NPM and PyPi.

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.