GithubHelp home page GithubHelp logo

tdmalone / aws-billing-alerts Goto Github PK

View Code? Open in Web Editor NEW
5.0 3.0 1.0 60 KB

A simple Lambda function that sends SNS alerts when your current month's bill changes.

License: MIT License

JavaScript 100.00%
aws lambda aws-lambda aws-billing js javascript nodejs node-js sns aws-sns

aws-billing-alerts's Introduction

AWS Billing Alerts

A simple AWS Lambda function that sends SNS alerts when your current month's bill changes.

Setup

Instructions coming soon, but briefly, you'll need to turn on billing alerts and set them to save to a bucket; create the Lambda function and build & upload or push the code; and create an SNS topic and set the topic ARN as the value for the environment variable SNS_TOPIC in your Lambda function config.

Your Lambda function role will need access to the S3 bucket your billing alerts are being saved to, and you'll need to set up an S3 trigger in the Lambda console to run your function on 'Object Created (All)' events in your bucket. If you're using the bucket for other things as well, set the prefix to YOUR_AWS_ACCOUNT_ID-aws-billing-csv- to avoid triggering the Lambda function needlessly.

More detailed instructions - or perhaps even a CloudFormation template or a shell script to set it all up - will be coming at some stage!

Tests

To run all tests at once:

yarn test

Unit Tests

To run:

yarn unit-tests

Unit tests are yet to be written, and will currently just pass.

Integration Tests

To run:

yarn docker-tests

Integration tests require Docker. They run in lambci/lambda:nodejs6.10 (GitHub | Docker Hub).

The following environment variables must be defined on your system:

  • SNS_TOPIC
  • BUCKET_NAME
  • AWS_ACCESS_KEY_ID
  • AWS_SECRET_ACCESS_KEY
  • AWS_DEFAULT_REGION

TODO

  • Add full setup instructions
  • Exclude bill events that are not for the current month
  • Save reports and check if the price has changed since the last check
  • Report exactly which line items changed
  • Add a CloudFormation script - or a shell script running AWS CLI commands - to automate initial setup
  • Move to a more scalable way of using csv-parse - i.e. buffer the stream so the entire CSV doesn't sit in memory
  • Write unit tests

License

MIT.

aws-billing-alerts's People

Contributors

tdmalone avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

chromatixau

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.