2024-04-11 14:23:07 +00:00
|
|
|
id: cw-alarm-action-set
|
|
|
|
info:
|
|
|
|
name: CloudWatch Alarm Action Not Set
|
|
|
|
author: princechaddha
|
|
|
|
severity: medium
|
|
|
|
description: |
|
|
|
|
Ensure Amazon CloudWatch alarms have actions configured for the ALARM state to automate response to incidents.
|
|
|
|
impact: |
|
|
|
|
Without actions, CloudWatch alarms may not trigger automated incident response or notifications, potentially delaying mitigation.
|
|
|
|
remediation: |
|
|
|
|
Configure at least one action for each CloudWatch alarm to ensure timely response to monitored issues.
|
|
|
|
reference:
|
|
|
|
- https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/AlarmThatSendsEmail.html
|
|
|
|
tags: cloud,devops,aws,amazon,cloudwatch,aws-cloud-config
|
|
|
|
|
|
|
|
variables:
|
|
|
|
region: "us-east-1"
|
|
|
|
|
|
|
|
flow: |
|
|
|
|
code(1)
|
|
|
|
for(let AlarmName of iterate(template.alarms)){
|
|
|
|
set("alarm", AlarmName)
|
|
|
|
code(2)
|
|
|
|
}
|
|
|
|
|
|
|
|
self-contained: true
|
|
|
|
code:
|
|
|
|
- engine:
|
|
|
|
- sh
|
|
|
|
- bash
|
|
|
|
source: |
|
|
|
|
aws cloudwatch describe-alarms --region $region --query 'MetricAlarms[].AlarmName' --output json
|
|
|
|
|
|
|
|
extractors:
|
|
|
|
- type: json
|
|
|
|
name: alarms
|
|
|
|
internal: true
|
|
|
|
json:
|
|
|
|
- '.[]'
|
|
|
|
|
|
|
|
- engine:
|
|
|
|
- sh
|
|
|
|
- bash
|
|
|
|
source: |
|
|
|
|
aws cloudwatch describe-alarms --region $region --alarm-names "$alarm" --query 'MetricAlarms[*].AlarmActions[]' --output json
|
|
|
|
|
|
|
|
matchers:
|
|
|
|
- type: word
|
|
|
|
words:
|
|
|
|
- "[]"
|
|
|
|
|
|
|
|
extractors:
|
|
|
|
- type: dsl
|
|
|
|
dsl:
|
|
|
|
- '"The Amazon CloudWatch " + alarm +" is not configured with any actions for the ALARM state."'
|
2024-04-11 14:25:25 +00:00
|
|
|
# digest: 4a0a004730450220699edd21da9a908d8160230a38300e78c76cce31988d83565ed8b7a0c9b41d70022100c607f34933362074e992f81390dae32347f888ffa68a9d97aac8aad03a388f55:922c64590222798bb761d5b6d8e72950
|