Control: CloudWatch alarm should have an action configured
Description
Checks if CloudWatch alarms have an action configured for the ALARM, INSUFFICIENT_DATA, or OK state. Optionally checks if any actions match a named ARN. The rule is non-compliant if there is no action specified for the alarm or optional parameter.
Usage
Run the control in your terminal:
powerpipe control run aws_compliance.control.cloudwatch_alarm_action_enabled
Snapshot and share results via Turbot Pipes:
powerpipe loginpowerpipe control run aws_compliance.control.cloudwatch_alarm_action_enabled --share
SQL
This control uses a named query:
select arn as resource, case when jsonb_array_length(alarm_actions) = 0 and jsonb_array_length(insufficient_data_actions) = 0 and jsonb_array_length(ok_actions) = 0 then 'alarm' else 'ok' end as status, case when jsonb_array_length(alarm_actions) = 0 and jsonb_array_length(insufficient_data_actions) = 0 and jsonb_array_length(ok_actions) = 0 then title || ' no action enabled.' when jsonb_array_length(alarm_actions) != 0 then title || ' alarm action enabled.' when jsonb_array_length(insufficient_data_actions) != 0 then title || ' insufficient data action enabled.' when jsonb_array_length(ok_actions) != 0 then title || ' ok action enabled.' else 'ok' end as reason , region, account_idfrom aws_cloudwatch_alarm;