Score:0

How to snooze all cloudwatch alarms at specific time?

be flag

I am trying to setup snooze option for all alarms in my AWS account. To accomplish this I have tried the below terraform code. I kept my account id as dummy value 12345678.

resource "aws_cloudwatch_event_rule" "snooze_alarms_rule" {
  name        = "snooze_alarms_rule"
  description = "Snooze alarms every Sunday from 12:30 PM to 6:30 PM CST"
  schedule_expression = "cron(30 18 ? * SUN *)" # 6:30 PM CST is 12:30 AM UTC, so we use that timezone
}

resource "aws_cloudwatch_event_target" "snooze_alarms_target" {
  rule      = aws_cloudwatch_event_rule.snooze_alarms_rule.name
  arn       = "arn:aws:automate:${var.region}:12345678:snooze:action/SetAlarmState"
  target_id = "snooze_alarms_target" #"arn:aws:sns:${var.region}:12345678:snooze"
  input = jsonencode({
    "Action": "Snooze",
    "StateValue": "ALARM",
    "Description": "Snoozing all alarms for maintenance",
    "Duration": 21600 # 6 hours in seconds
  })
}

But it is giving below error.

Error: creating EventBridge Target (snooze_alarms_rule-snooze_alarms_target): ValidationException: automate is not a supported service for a target. │ status code: 400, request id: 56d52814-fc5f-449b-91f5-70f14a0073cf │ │ with aws_cloudwatch_event_target.snooze_alarms_target, │ on snooze.tf line 7, in resource "aws_cloudwatch_event_target" "snooze_alarms_target": │ 7: resource "aws_cloudwatch_event_target" "snooze_alarms_target" {

I would appreciate any help offered.

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.