Git Product home page Git Product logo

cloudwatch-public-metrics's Introduction

Logo

serverless

Expose AWS Cloudwatch Metrics as a public HTML page using AWS Lambda and server-side rendering, for free. Inspired by Yan Cui's concept & status.github.com

Demo

Demo

Todo - my AWS account estimated charges

Usage

First, ensure that you have Serverless Framework installed. If not, install it:

$ npm install serverless -g

Clone the repo, install dependencies and deploy function:

$ git clone https://github.com/RafalWilinski/cloudwatch-public-metrics
$ npm install
$ npm run deploy

Config

cloudwatch-public-metrics can be configured in two ways:

  1. Using config.yml file:
METRIC_NAME: <Use "Namespace//MetricName" format e.g.: AWS/Billing//EstimatedCharges>   *required*
METRIC_TITLE: <Add custom title like: "Total AWS Charges">
METRIC_DURATION: <EndDate - StartDate e.g: "7 days">                                    *required*
METRIC_STATISTIC: <One of: ["Average", "Sum", "SampleCount", "Minimum", "Maximum"]>     *required*
METRIC_DIMENSIONS: <Comma separated array of Name=Value pair e.g.: "Currency=USD,InstanceId=123">
METRIC_SUFFIX: <For instance "%", "ms" or "$">
USAGE_PLAN: <Rate limiting configuration, see: https://serverless.com/framework/docs/providers/aws/guide/serverless.yml/>
  1. Using CLI flags:
$ npm run deploy -- \
 --metricName AWS/Billing//EstimatedCharges \
 --metricTitle Estimated\ Charges \
 --metricDuration 15\ days \
 --metricStatistic Average \
 --metricDimensions Currency\=USD \
 --metricSuffix \$

Development

AWS_REGION=us-east-1 npm run watch

License

MIT © Rafal Wilinski

Credits

Logo by Dinosoft Labs

cloudwatch-public-metrics's People

Contributors

rafalwilinski 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  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

toketunji anibus

cloudwatch-public-metrics's Issues

Add interactivity to chart

Right now whole page is 100% static and does not allow any interactions.

Question: Do you believe that adding interactions to chart would be beneficial?

Decrease artifact size

Right now service zip file is 17.25 MB which is definitely too big for such simple app.

Add npx integration

It should be possible to provision whole page using one npx-based command.

Something like:

npmx cloudwatch-public-metrics \
  --metricName AWS/Billing//EstimatedCharges \
  --metricDuration 15days \
  and so on..

Blocked by: #4

Add rate limiting

To prevent DDoS attacks, it should be possible to config rate limiting. It is possible to setup it inside API Gateway options but does Serverless framework supports that? Need to check.

Add eslint setup

To prevent basic bugs and enforce consistent codestyle, eslint should be added.

Add ability to expose multiple metrics at once

As title says. Building simple dashboards should be also possible.

I have a notion that it would require change the way how config is passed to lambda function. Instead of using env variables which are a bit primitive, config should be hardcoded before deployment and expressed in .js file?

Fix lambda permissions

After deploying function to AWS, seems like Lambda has incorrect IAM policies attached:

AccessDenied: User: arn:aws:sts::085108115628:assumed-role/lambda-dashboard-dev-us-east-1-lambdaRole/lambda-dashboard-dev-main is not authorized to perform: cloudwatch:GetMetricStatistics
    at Request.extractError (/var/runtime/node_modules/aws-sdk/lib/protocol/query.js:47:29)
    at Request.callListeners (/var/runtime/node_modules/aws-sdk/lib/sequential_executor.js:105:20)
    at Request.emit (/var/runtime/node_modules/aws-sdk/lib/sequential_executor.js:77:10)
    at Request.emit (/var/runtime/node_modules/aws-sdk/lib/request.js:683:14)
    at Request.transition (/var/runtime/node_modules/aws-sdk/lib/request.js:22:10)
    at AcceptorStateMachine.runTo (/var/runtime/node_modules/aws-sdk/lib/state_machine.js:14:12)

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.