Search code examples
amazon-web-servicesaws-lambdamonitoringmetricsamazon-cloudwatch

AWS: Alarming on Metric Math alternative


I am currently in the process of migrating some services to AWS and have hit a bit of a road block. I would like to be able to monitor the error percentage of a Lambda and create an Alarm if a certain threshold is breached. Currently the percentage error rate can be calculated with Metric Math, however alarms cannot be generated from this.

I was wondering if anyone know a way in that I could push the metrics require to calculate the percentage, Error and Invocation, to a Lambda and have the Lambda perform the calculation and create the SNS alarm?

Thanks!


Solution

  • CloudWatch just released the Alarms on MetricMath expressions.

    https://aws.amazon.com/about-aws/whats-new/2018/11/amazon-cloudwatch-launches-ability-to-add-alarms-on-metric-math-expressions/

    So basically you just need to:

    1. Go to CloudWatch
    2. Go to Alarms
    3. Create Alarm
    4. Add your metrics
    5. Add a MetricMath expression
    6. Optionally, add other properties for the alarm
    7. Add the actions that you want to be executed

    More information in their documentation