2

As far I know there have been multiple approaches to do this. Some approaches that I know are

  1. Monitoring cloudwatch events and trigger a cloud watch alarm if lambda fails. Using cloud watch alarm we can trigger sns/slack.

Using the first approach, I can't use a single alarm to monitor my lambdas. Because If I have 100s of lambdas it is difficult to identify which lambda is actually failed.

  1. Using Destination. we can trigger sns or another lambda function asynchronously on failure.

Are there any other ways to get notified on lambda failures? If so, which is the best approach?

2 Answers 2

3

Not sure what you mean by "I can't use a single alarm to monitor my lambdas", generally you have one single alarm per lambda. This is a good practice since every lambda could have a different set of characteristics so your monitoring metrics can vary from one to the other. This also helps you since every alarm can have a different name like service-stage-region-alarm-myFunction so it is easily identified. Generate one alarm per lambda can easily be done if you are using frameworks like serverless or SAM and is a reasonable task with tools like terraform or cloudformation.

Second approach could be a valid one if you want to fire one notification per error. This probably is not what you want since under heavy traffic you don't want to receive hundreds of messages with the same error. Also it does not work for synchronous lambdas (like the ones attached to APIGateway).

Sign up to request clarification or add additional context in comments.

Comments

0

@RoberMP listed very good points. To extend him;

After creating individual alarms with different configurations, thresholds and limits you may not want to trigger SNS/Slack after each failure.

If you don't want to create too much noise with those alarms, you may combine your first approach with composite alarms.

Using composite alarms can help you reduce alarm noise. If you set up a composite alarm to notify you of state changes, but set up the underlying metric alarms to not send notifications themselves, you will be notified only when the alarm state of the composite alarm changes.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.