cdklabs / cdk-monitoring-constructs

Easy-to-use CDK constructs for monitoring your AWS infrastructure
https://constructs.dev/packages/cdk-monitoring-constructs
Apache License 2.0
476 stars 67 forks source link

Lambda Support as CloudWatch Alarm Action #560

Open rememberYou opened 2 months ago

rememberYou commented 2 months ago

Feature scope

CloudWatch

Describe your suggested feature

Since the end of December 2023, AWS now supports the triggering of a Lambda function as a CloudWatch Alarm action target (cf. https://aws.amazon.com/about-aws/whats-new/2023/12/amazon-cloudwatch-alarms-lambda-change-action/). This is useful, for example, when you want to modify the email body before sending it to another SNS topic where a list of email addresses is subscribed.

Currently, cdk-monitoring-constructs only supports SNS topics like CloudWatch Alarms action. Would it be possible to implement Lambda as an Alarm action as well?

echeung-amzn commented 2 months ago

Seems reasonable to add, but we'd need to bump up to >= v2.119.0 first (we're currently at >= v2.112.0).

https://github.com/aws/aws-cdk/commit/b9f49234d2c317d1c7dc143994d3e3b3b7bc430a

In the meantime if you're already using a newer version of aws-cdk-lib, you can implement something like how SNS is handled, but using LambdaAction.