CDK CloudFormation Datadog Monitors Monitor

raw JSON →
4.8.0a7 verified Mon Apr 27 auth: no python maintenance

This is an AWS CDK construct library that provides a L1 CloudFormation resource for Datadog Monitor (DATADOG::MONITORS::MONITOR). It wraps the Datadog Monitor CloudFormation resource, allowing you to define and manage Datadog monitors as part of your CDK infrastructure. The current version is 4.8.0a7 (alpha). The library is part of the cdklabs/cdk-cloudformation project, which generates CDK constructs for CloudFormation registry resources. The library is in maintenance mode and has a release cadence tied to upstream CloudFormation registry changes.

pip install cdk-cloudformation-datadog-monitors-monitor==4.8.0a7
error ImportError: cannot import name 'CfnMonitor' from 'cdk_cloudformation_datadog_monitors_monitor'
cause Misspelled module name or missing installation of the correct package.
fix
Install the package: pip install cdk-cloudformation-datadog-monitors-monitor==4.8.0a7. Ensure the import is from cdk_cloudformation_datadog_monitors_monitor import CfnMonitor.
error ModuleNotFoundError: No module named 'cdk_cloudformation_datadog_monitors_monitor'
cause Package not installed or installed with a different version.
fix
Install the package: pip install cdk-cloudformation-datadog-monitors-monitor==4.8.0a7.
error Resource of type 'DATADOG::MONITORS::MONITOR' does not exist in the CloudFormation registry
cause The Datadog CloudFormation resource provider is not registered in your AWS account.
fix
Register the Datadog resource provider using the AWS CloudFormation registry or the Datadog integration.
breaking CfnMonitor is a L1 construct - it directly maps to the CloudFormation resource schema. Properties may change with schema updates, breaking your stack if you rely on internal implementation details.
fix Always check the CloudFormation resource documentation for the latest property types. Pin your library version and test schema changes.
deprecated This library is in maintenance mode. The cdklabs/cdk-cloudformation project is no longer actively maintained. New features and bug fixes may not be provided.
fix Consider migrating to a dedicated Datadog CDK construct (e.g., datadog-cdk-constructs) or using the CloudFormation resource directly.
gotcha The library uses underscores in Python package names (cdk_cloudformation_datadog_monitors_monitor), but the PyPI package name uses hyphens. This mismatch often causes import errors.
fix Install with pip using hyphens, but import using underscores: `from cdk_cloudformation_datadog_monitors_monitor import CfnMonitor`.
gotcha The resource requires a CloudFormation resource provider to be registered in your AWS account. Without the Datadog resource provider, the CloudFormation stack will fail.
fix Register the Datadog resource provider in your AWS account by following the Datadog CloudFormation integration guide. You may need to use a custom resource provider or the Datadog AWS integration.

Creates a Datadog monitor using the CDK CloudFormation resource. Note: This construct requires a Datadog API key and application key to be set up via CloudFormation resource provider or environment variables.

from aws_cdk import App, Stack
from cdk_cloudformation_datadog_monitors_monitor import CfnMonitor

app = App()
stack = Stack(app, "MyStack")

CfnMonitor(stack, "MyDatadogMonitor",
    type="metric alert",
    query="avg(last_5m):avg:system.cpu.user{*} > 80",
    message="High CPU usage",
    name="High CPU Alert",
    options={
        "notify_no_data": True,
        "no_data_timeframe": 10,
        "thresholds": {
            "critical": 80.0
        }
    },
    tags=["env:production"]
)

app.synth()