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 toNotificationTopic
Resource AWS Simple Notification Service (SNS) topicNotificationEventRule
Resource The AWS CloudWatch event rule to test
$ git clone git@github.com:mapbox/cwevents-playground.git
$ cd cwevents-playground
$ npm install
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.
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]