Using this tutorial I created a lambda function, when it fails a cloud watch alarm causes SNS to send out emails using the lambda errors metric. I'm using it to check if any ec2 instances have upcomming scheduled events. Right now this is the info CloudWatch and SNS sends in its emails:
Alarm Details:
- Name: ec2-scheduled-events-alarm
- Description: an ec2 instance has an upcomming scheduled event
- State Change: OK -> ALARM
- Reason for State Change: Threshold Crossed: 1 datapoint (1.0) was greater than or equal to the threshold (1.0).
- Timestamp: Wednesday 12 September, 2016 00:16:54 UTC
- AWS Account: ..........
Threshold:
- The alarm is in the ALARM state when the metric is GreaterThanOrEqualToThreshold 1.0 for 300 seconds.
Monitored Metric:
- MetricNamespace: AWS/Lambda
- MetricName: Errors
- Dimensions:
- Period: 300 seconds
- Statistic: Sum
- Unit: not specified
State Change Actions:
- OK:
- ALARM: [arn:aws:sns:us-west-2:..........:ec2-scheduled-events]
- INSUFFICIENT_DATA:
I would like to change this message to also contain info from my lambda script (such as listing out ec2 instances I defined as failing). How can I do this? I'm guessing it involves changing the output of the Monitored Metric:
- Dimensions:
somehow.
Or better yet how can I just have my emails contain the Log output of my lambda function?