/cwevents-playground

A simple architecture for testing AWS CloudWatch event patterns in situ using AWS CloudFormation

Primary LanguageJavaScript

cwevents-playground

A simple architecture for testing AWS CloudWatch event patterns in situ using AWS CloudFormation. The CloudFormation template is comprised of the following:

  • NotificationEmail Parameter Email address to send AWS CloudWatch event details to
  • NotificationTopic Resource AWS Simple Notification Service (SNS) topic
  • NotificationEventRule Resource The AWS CloudWatch event rule to test

Install

$ git clone git@github.com:mapbox/cwevents-playground.git
$ cd cwevents-playground
$ npm install

Configure the CloudWatch event pattern

By default, the CloudWatch event pattern in the CloudFormation is configured to poll for EC2 instances that have transitioned into a stopped state:

EventPattern: {
  source: ['aws.ec2'],
  'detail-type': ['EC2 Instance State-change Notification'],
  detail: { state: ['stopped'] }
}

Update the default event pattern to the pattern you would like to test.

Create your stack

You can build your template and print the result in your console:

$ npm run build

Or, you can create a stack with the cfn-config CLI:

$ npm install -g cfn-config
$ cfn-config create <environment> cloudformation/cwevents-playground.template.js [options]