Skip to content

Dachmian/cdk-datadog-resources

 
 

Repository files navigation

AWS CDK Datadog Resources

npm version

An AWS CDK construct library that wraps DataDog/datadog-cloudformation-resources.

Requirements

Before using this library, register datadog-cloudformation-resources to your AWS account.

You need to register the correct version listed in Supported Resources.

Supported CDK Languages

  • TypeScript
  • Python
  • Java Sorry, there is a problem with the release. (#22)

Supported Resources

Supported? Resource Datadog CF Resource Name Description Datadog CF Version
Dashboards Datadog::Dashboards::Dashboard Create, update, and delete Datadog dashboards. 1.0.0
Datadog-AWS integration Datadog::Integrations::AWS Manage your Datadog-Amazon Web Service integration. 1.1.0
Monitors Datadog::Monitors::Monitor Create, update, and delete Datadog monitors. 3.0.0
Downtimes Datadog::Monitors::Downtime Enable or disable downtimes for your monitors. 2.0.0
Users Datadog::IAM::User Create and manage Datadog users. 1.2.0

Installation

TypeScript

npm install @nomadblacky/cdk-datadog-resources

Python

pip install cdk-datadog-resources

Java

<dependency>
    <groupId>dev.nomadblacky</groupId>
    <artifactId>cdk-datadog-resources</artifactId>
    <version>x.y.z</version>
</dependency>

Usage

Below are examples of TypeScript.

Dashboards

import * as fs from 'fs';
import { DatadogDashboard } from '@nomadblacky/cdk-datadog-resources';

new DatadogDashboard(yourStack, 'TestDashboard', {
  datadogCredentials: {
    apiKey: process.env.DATADOG_API_KEY!,
    applicationKey: process.env.DATADOG_APP_KEY!,
  },
  dashboardDefinition: fs.readFileSync(`${__dirname}/path/to/your/dashboard-definition.json`).toString(),
});

Monitors

import { DatadogMonitor } from '@nomadblacky/cdk-datadog-resources';

new DatadogMonitor(yourStack, 'TestMonitor', {
  datadogCredentials: {
    apiKey: process.env.DATADOG_API_KEY!,
    applicationKey: process.env.DATADOG_APP_KEY!,
  },
  query: 'avg(last_1h):sum:system.cpu.system{host:host0} > 100',
  type: MonitorType.QueryAlert,
  name: 'Test Monitor',
  options: {
    thresholds: {
      critical: 100,
      warning: 80,
      oK: 90,
    },
    notifyNoData: true,
    evaluationDelay: 60,
  },
});

Downtimes

import { DatadogDowntime } from '@nomadblacky/cdk-datadog-resources';

new DatadogDowntime(stack, 'TestMonitor', {
  datadogCredentials: {
    apiKey: 'DATADOG_API_KEY',
    applicationKey: 'DATADOG_APP_KEY',
  },
  scope: ['host:myserver', 'service:myservice'],
  start: 1624542715,
  end: 1624546321,
});

Users

import { DatadogIAMUser } from '@nomadblacky/cdk-datadog-resources';

new DatadogIAMUser(stack, 'TestUser', {
  datadogCredentials: {
    apiKey: 'DATADOG_API_KEY',
    applicationKey: 'DATADOG_APP_KEY',
  },
  email: 'jane.doe@example.com',
  name: 'name_example',
  handle: 'title_example',
  disabled: false,
});

DataDog Integration

import { DatadogIntegrationAWS } from '@nomadblacky/cdk-datadog-resources';

new DatadogIntegrationAWS(this, 'DataDogIntegration', {
  datadogCredentials: {
    apiKey: "DATADOG_API_KEY",
    applicationKey: "DATADOG_APP_KEY",
  },
  accountId: "ACCOUNT_ID",
  roleName: "DatadogIntegrationRole",
});

About

Manage Datadog Monitor etc. with AWS CDK.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • TypeScript 52.1%
  • JavaScript 47.9%