Hello, CloudWatch currently cannot be configured to periodically re-execute action(s) while an alarm remains in a given (e.g. ALARM) state. There are a few ways to work around this limitation.
Your suggestion works
You could use a lambda to implement the action, configure the lambda to trigger on an alarm state change event, and from the lambda create a scheduled event that will re-trigger the lambda after a given interval if the alarm is still in ALARM state. Up to now, this is the most common way I've heard of to implement alarming recurrence.
I believe using metric math is now a simpler way in some cases (I think it works well for your 2nd case, at 9am every morning). You can create a metric math alarm that will "zero" your metric's value (or offset it below threshold) at given times/days, so your alarm will be forced into OK status over those times, and evaluate the real metric value only at given times/intervals. For example IF(HOUR(m1)>7 AND HOUR(m1)<9 AND MINUTE(m1)<45, m1, 0) will zero your value except every day between 8:00am and 8:45am - that's just an example, you might be interested by the following blog post https://aws.amazon.com/blogs/mt/enhance-cloudwatch-metrics-with-metric-math-functions/
The drawback is that it needs you to potentially create 2 alarms if you need to also monitor your metric continuously (as most of the time, this metric math alarm would not evaluate anything and show up as OK).
I supposed you could re-trigger stale alarms. I'm envisioning a Lambda that runs every morning looking for alarms that have been active more than X (6?) hours. It could then update those alarms (SetAlarmState?) to force a re-trigger of the action.
It's not a very elegant solution and it seems like someone, somewhere would have run into this problem before. Is there not a native solution to stale CW alarms?
- asked 9 months ago
- Accepted Answerasked a month ago
- asked 12 days ago
- AWS OFFICIALUpdated 5 months ago
- AWS OFFICIALUpdated 3 years ago
- How can I monitor daily EstimatedCharges and trigger a CloudWatch alarm based on my usage threshold?AWS OFFICIALUpdated 9 months ago
- AWS OFFICIALUpdated 6 months ago
- SUPPORT ENGINEERpublished 4 months ago
- EXPERTpublished 3 months ago