0

I want to automatically toggle CloudWatch alarms off/on during specific periods of time every other week so that they do not fire during maintenance windows. Much like Can AWS CloudWatch alarms be paused/disabled during specific hours?. However, our maintenance windows are not every day, they're every two weeks.

I like both of the options provided in the above answer for either a cronjob or CloudWatch metrics. I just can't get my head around how to implement them every other week. For example, 8pm-10pm every other Monday.

Our CloudWatch alarms monitor the health of our Elastic Beanstalks, which go into an unhealthy state when they're being updated/maintained.

  • Does this answer the question? https://stackoverflow.com/questions/350047/how-to-instruct-cron-to-execute-a-job-every-second-week – gshpychka Nov 23 '21 at 10:28
  • Thank you this does look like a great way to configure from a cronjob. But the more I think about it, I'm not sure that cronjob is the way to go. The task I'm trying to achieve is to suppress Beanstalk health alerts. Wouldn't a cronjob just be suppressing metrics on an ec2 instance? I think cronjobs may be too complicated. I like the idea of using a math expression like the one in the original question "IF(HOUR(m) > 8 && HOUR(m) < 18, m, m+0.01)". However, I'm not great with the syntax here. Could there be an option for If Week = odd/even and hour is between 20 and 22? – Luke Welden Nov 24 '21 at 10:38
  • I managed to fix this using the same logic in https://stackoverflow.com/questions/24737359/can-aws-cloudwatch-alarms-be-paused-disabled-during-specific-hours?rq=4 – Luke Welden Jul 28 '23 at 08:14
  • Glad you figured it out. I guess this one is a duplicate, then. – gshpychka Jul 28 '23 at 11:21

0 Answers0