0

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.

2 Answers 2

1

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.

1

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 e.g. 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.

Not the answer you're looking for? Browse other questions tagged or ask your own question.