简体   繁体   中英

AWS CloudWatch alert on every change in metric

Can you set up CloudWatch to fire an event (which can lead to a Lambda function being called) on every change to a metric? I can see how to fire an even when it meets a boundary via alerts, but I'd like an event on every change.

No.

A CloudWatch Alarm is triggered when a calculated metric goes outside a given bound over a desired time period. It is always a calculated value (eg average, sum, min, max) and is not based upon an individual metric.

That said, if you have very sparse metrics (that don't trigger very often), using COUNT or SUM might be sufficient but it isn't specifically what you are requesting.

If you have a metric that behaves in a predictable way then you can indeed achieve this kind of behaviour.

If you have a metric with a small set of possible values, for example, consider a metric where the value can be 0 or 1.

You could then create a CloudWatch alarm where the threshold is 0 for 1 period and then a second alarm where the threshold is 1 for 1 period.

So basically for each possible value that your metric can be, you would have an alarm. Each of these alarms would trigger an action of your choice eg SNS

As I said, this would only work if you have a metric with a known set of possible values, not with a metric that can have unpredictable values.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM