npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

cdk-dashboard

v0.1.0

Published

AWS CDK construct for creating dashboards from CDK stacks

Downloads

68

Readme

CDK Dashboard

A CDK construct library that automatically creates CloudWatch dashboards for AWS CDK stacks. It scans your stack for supported resources and generates organized, service-grouped dashboard widgets to monitor your infrastructure.

Features

  • Zero-Config Resource Discovery: Uses CDK Aspects to automatically find and monitor resources in your stack
  • Pre-configured Metric Widgets: Creates optimized CloudWatch widgets with the most useful metrics for each service
  • Consistent Dashboards: Standardizes dashboard layout and metrics across all your stacks
  • Custom Widget Support: Allows adding your own custom CloudWatch widgets alongside auto-discovered resources
  • Supported AWS Services:
    • Lambda Functions (invocations, errors, duration, throttles)
    • API Gateway (request count, latency, error rates)
    • DynamoDB Tables (read/write capacity, throttling, query/scan performance)
    • SNS Topics (published messages, delivery success/failure)
    • SQS Queues (sent/received messages, queue depth, message age)

Installation

npm install cdk-dashboard

Usage

Basic Usage

import { Stack, App } from 'aws-cdk-lib';
import { CdkDashboard } from 'cdk-dashboard';

class MyStack extends Stack {
  constructor(scope: App, id: string) {
    super(scope, id);

    // Define your AWS resources here
    // ...

    // Create a dashboard for this stack
    new CdkDashboard(this, 'Dashboard', {
      dashboardName: 'my-service-dashboard'
    });
  }
}

Customizing the Dashboard

You can customize the dashboard name:

new CdkDashboard(this, 'CustomDashboard', {
  dashboardName: 'production-monitoring'
});

Adding Custom Widgets

You can add your own custom CloudWatch widgets alongside the automatically discovered resource widgets:

import { GraphWidget, TextWidget, Metric } from 'aws-cdk-lib/aws-cloudwatch';

// Create a dashboard
const dashboard = new CdkDashboard(this, 'CustomDashboard', {
  dashboardName: 'production-monitoring'
});

// Add a text header
dashboard.addWidgets(
  new TextWidget({
    markdown: '# Custom Metrics',
    width: 24,
    height: 1
  })
);

// Add a custom metric graph
dashboard.addWidgets(
  new GraphWidget({
    title: 'Custom Application Metrics',
    left: [
      new Metric({
        namespace: 'CustomNamespace',
        metricName: 'SuccessRate',
        dimensionsMap: { Service: 'MyService' },
        statistic: 'Average'
      })
    ],
    width: 12,
    height: 6
  })
);

How It Works

The cdk-dashboard library uses CDK's Aspects feature to traverse the construct tree of your stack. It identifies resources by type and collects them into service groups. Then it generates optimized metrics and widgets for each service type.

Service Metrics

The library creates these metrics for each service:

Lambda Functions

  • Invocations
  • Duration (ms)
  • Errors
  • Throttles

API Gateway

  • Request Count
  • Latency (ms)
  • 4XX Errors
  • 5XX Errors

DynamoDB

  • Read/Write Capacity Units
  • Throttle Events
  • Query Latency
  • Scan Latency

SNS Topics

  • Messages Published
  • Notifications Delivered
  • Notifications Failed

SQS Queues

  • Messages Sent
  • Messages Received
  • Visible Messages
  • Age of Oldest Message

Example

Here's a complete example that creates a stack with some AWS resources and adds a dashboard:

import { App, Stack, StackProps, Duration } from 'aws-cdk-lib';
import { NodejsFunction } from 'aws-cdk-lib/aws-lambda-nodejs';
import { Table, AttributeType, BillingMode } from 'aws-cdk-lib/aws-dynamodb';
import { Queue } from 'aws-cdk-lib/aws-sqs';
import { Topic } from 'aws-cdk-lib/aws-sns';
import { CdkDashboard } from 'cdk-dashboard';

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

    // Create a Lambda function
    const processor = new NodejsFunction(this, 'Processor', {
      entry: 'src/handler.js',
      handler: 'handler'
    });

    // Create a DynamoDB table
    const table = new Table(this, 'Items', {
      partitionKey: { name: 'id', type: AttributeType.STRING },
      billingMode: BillingMode.PAY_PER_REQUEST
    });

    // Create an SQS queue
    const queue = new Queue(this, 'ItemsQueue');

    // Create an SNS topic
    const topic = new Topic(this, 'ItemsTopic');

    // Create a dashboard for this stack
    new CdkDashboard(this, 'Dashboard', {
      dashboardName: 'example-dashboard'
    });
  }
}

const app = new App();
new ExampleStack(app, 'ExampleStack');
app.synth();

Advanced Usage

The CdkDashboard construct is highly reusable. You can create specialized dashboards for different parts of your infrastructure by controlling the scope:

// Create a dashboard for a specific construct and its children
new CdkDashboard(apiConstruct, 'ApiDashboard', {
  dashboardName: 'api-metrics'
});

// Create a dashboard for a specific database and its resources
new CdkDashboard(databaseConstruct, 'DatabaseDashboard', {
  dashboardName: 'db-metrics'
});

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

MIT