Skip to main content

Lambda cloudformation custom resource that sets up datadog alerts

Project description


### What is this repository for? ###

* To setup datadog monitoring via cloudformation

### What does it do? ###

It setups a lambda function that communicate with the monitors resource
on the datadog api

The lambda is invoked via cloudformation custom resource. This repo
supplies custom resource classes for all the 4 Monitor types.
Custom resources have the same exact data structure as the DD api

It uses to securely store
datadog api credentials

### How do I get set up? ###

* clone this repo
git clone

* Build the lambda package
chmod +x && ./

* upload `` to an s3 bucket
* get your api and application keys from Datadog
* generate the lambda template
python > /tmp/lambda.template
* If you have not already set up your encrypt stack do that now ( )
* create a stack from your `lambda.template` file
* The lambda is now set up and ready to use.

### How do i use it to monitor resources created in other stacks? ###

Install the cfn_datadog library
pip install cfn-encrypt

Import the custom resource classes you want to use
from cfn_datadog import (
MetricAlert, MetricAlertOptions, Composite, CompositeOptions,
EventAlert, EvenAlertOptions, ServiceCheck, ServiceCheckOptions

Add a parameter so that you can reference your lambda stack
datadog_lambda_stackname = t.add_parameter(Parameter(
Description="Datadog lambda stackname",

Add the custom resource to the template: For documentation see datadog api
query=Join("",["avg(last_1h){host:",Ref(my_instance),"} < 40"]),
name="Bytes received on mytesthost",
message="Some Message @MyDDHandle",
tags=["tag1", "tag2"],
notify_no_data= True,

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for cfn-datadog, version 0.0.12
Filename, size File type Python version Upload date Hashes
Filename, size cfn_datadog-0.0.12-py2.py3-none-any.whl (8.1 kB) File type Wheel Python version py2.py3 Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page