mapbox / cloudfriend

Helper functions for assembling CloudFormation templates in JavaScript
ISC License
69 stars 9 forks source link

Add a shortcut for a CloudWatch alarm triggering a Lambda Function #106

Open mcwhittemore opened 4 years ago

mcwhittemore commented 4 years ago

Getting a Lambda Function to be triggered by a CloudWatch Alarm requires one to create a SNS Topic and Lambda permission and wire them up correctly to the Alarm and Lambda function. These are boilerplate and feel like something we could shortcut so as to simplify the process of figuring this out. That said, I'm not sure what sort of barriers we want on the shortcuts we offer here. Any thoughts on if this makes the mark?

rclark commented 4 years ago

I think this'd be meaningful. AWS doesn't have a direct alarm --> lambda pathway yet?

mcwhittemore commented 4 years ago

Not that I have found and the example doc that hitting the top of google for me shows how to set this up via PowerShell which is pretty hard to parse. https://aws.amazon.com/blogs/developer/send-real-time-amazon-cloudwatch-alarm-notifications-to-amazon-chime/

rclark commented 4 years ago

CloudWatch API reference docs confirm that you can only use certain services as alarm actions, and lambda isn't included. So yeah, you need to stick an SNS topic in between the alarm and the Lambda.