Giter VIP home page Giter VIP logo

aws-cdk-lambda-cloudwatch-dashboard's Introduction

CloudWatch Lambda Dashboards using CDK

This project is an example of building a CloudWatch Dashboard for Lambdas to visualize the Invocations, Concurrent Executions, Duration, and Errors. The CDK Stack provided uses the CloudWatch Metric and GraphWidget classes to visualize the graphs. The project also includes a sample Lambda functions with API Gateway integrations to showcase the dashboards. The stack adds one row for each Lambda to the Dashboard to get a single view for selected metrics and alarms to help you assess the health of your Lambda resources. Invocations, Duration, Errors, and Concurrent Execution Metrics are the selected metrics.

Getting started

To get started, clone this cdk-lambda-dashboard. The repository contains a CDK App in TypeScript that deploys a CDK Stack.

To see or the edit the CloudWatch dashboard, please refer CDK App.

CDK Concepts

This topic describes some of the concepts (the why and how) behind the AWS CDK.

AWS CDK apps are composed of building blocks known as Constructs, which are composed together to form stacks and apps.

Please visit here for further referene.

Prerequisites

To run the sample, you will need:

  1. An AWS Account into which you will deploy services. Be sure that you have permissions to deploy resources in the AWS Account
  2. CDK Setup is completed by following this guide
  3. Node setup is completed by following this guide
  4. Configure your AWS profile using the quickstart guide

Deployment

To deploy the sample, perform the following:

  1. Clone the cdk-lambda-dashboard to your local
  2. Run npm install to install the necessary node modules needed for the project
  3. Run npm run build to compile the project
  4. Run cdk synth to see the CloudFormation template
  5. Run cdk deploy to deploy the Stack
  6. Upon successful deployment, you can go into CloudWatch to see the Dashboard (see/edit the cdk-lambda-dashboard.ts for Dashboard name). A sample snapshot is listed here.

LambdaDashboard

Clean up your Stack

You can delete the stack by running cdk destroy.

Useful commands

  • npm run build compile typescript to js
  • npm run watch watch for changes and compile
  • npm run test perform the jest unit tests
  • cdk deploy deploy this stack to your default AWS account/region
  • cdk diff compare deployed stack with current state
  • cdk synth emits the synthesized CloudFormation template
  • cdk destroy delete this stack from your default AWS Account/region

Reference Documentation

Security

See CONTRIBUTING for more information.

License

This library is licensed under the MIT-0 License. See the LICENSE file.

aws-cdk-lambda-cloudwatch-dashboard's People

Contributors

amazon-auto avatar mzambani avatar

Stargazers

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

Watchers

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

aws-cdk-lambda-cloudwatch-dashboard's Issues

Error after running "npm run test"

Is there any other step to follow?

Below is the error message:

Lambda Dashboard Created (43 ms)

โ— Lambda Dashboard Created
None of 0 resources matches resource 'AWS::CloudWatch::Dashboard' with {
"$objectLike": {
"DashboardName": "myLambdaDashboard"
}
}.

  10 |   });
  11 |     // THEN
> 12 |     expectCDK(stack).to(haveResource("AWS::CloudWatch::Dashboard", {
     |                      ^
  13 |       DashboardName: "myLambdaDashboard"
  14 |     }));
  15 | });

  at HaveResourceAssertion.assertOrThrow (node_modules/@aws-cdk/assert/lib/assertions/have-resource.ts:100:13)
  at StackInspector._to (node_modules/@aws-cdk/assert/lib/inspector.ts:25:15)
  at StackInspector.to (node_modules/@aws-cdk/assert/lib/inspector.ts:15:14)
  at Object.<anonymous> (test/cdk-lambda-dashboard.test.ts:12:22)

Test Suites: 1 failed, 1 total
Tests: 1 failed, 1 total

How to use sample Lambda functions with API Gateway?

Hello,

First, it's a great project and I already followed the steps in README to deploy the Dashboard but no data for all of the widgets.

I noticed that this project also includes a sample Lambda functions with API Gateway integrations to showcase the dashboards. Is this API Gateway designed to generate some usage data to feed the Dashboard?

But How should I use them? I didn't see anywhere to mention this usage.

Thanks!

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.