Acting on Alarms and Reducing Noise with Composite Alarms
This lesson explains the actions CloudWatch alarms can perform directly, how everything else is done through Amazon EventBridge, and how composite alarms combine alarms to reduce noise.
Learning outcomes
After completing this lesson, you will be able to:
- Identify the actions a metric alarm can perform.
- Act on alarm state changes through EventBridge.
- Combine alarms with composite alarm rules.
- Recover instances automatically with an alarm action.
Actions a metric alarm can perform
A metric alarm can perform several kinds of action directly. It can publish to an SNS topic, which fans out to email, SMS, HTTPS, SQS and Lambda subscribers. It can perform an EC2 action on the instance named in its dimension: stop, terminate, reboot or recover. It can execute an Auto Scaling policy (step or simple scaling). It can invoke a Lambda function directly, with the alarm details as the event, provided the function's resource policy allows lambda.alarms.cloudwatch.amazonaws.com. It can create a Systems Manager OpsItem in OpsCenter for investigation.
The recover action moves an instance to new hardware when StatusCheckFailed_System fails, keeping its instance ID, private IP addresses, Elastic IP addresses and EBS volumes; data on instance store volumes is lost. Many current instance types also recover automatically by default (simplified automatic recovery), but the alarm action gives explicit control and notification. The reboot action suits StatusCheckFailed_Instance, which indicates a problem inside the operating system.
Direct alarm actions
Acting through EventBridge
Every alarm state change is also published to the default EventBridge bus as an event with source aws.cloudwatch and detail-type CloudWatch Alarm State Change. An EventBridge rule can match on the alarm name and new state and invoke any EventBridge target: a Systems Manager Automation runbook, a Step Functions state machine, an SQS queue, an event bus in another account or an API destination. This is the way to start an Automation runbook from an alarm, and it also lets one rule react to many alarms with a name prefix.
{
"source": ["aws.cloudwatch"],
"detail-type": ["CloudWatch Alarm State Change"],
"detail": {
"alarmName": [{"prefix": "prod-web-"}],
"state": {"value": ["ALARM"]}
}
}Composite alarms
A composite alarm evaluates a rule expression over the states of other alarms, such as ALARM("high-cpu") AND ALARM("high-latency") or ALARM("db-down") AND NOT ALARM("maintenance-window"). The underlying alarms can have no actions of their own, so operators receive one notification for a real incident instead of a storm of individual alerts. Action suppression silences the composite alarm's actions while a suppressor alarm is in ALARM, for example during deployments.
Composite alarms can notify SNS topics, invoke Lambda functions, create OpsItems (and Incident Manager incidents, although Incident Manager is closed to new customers), and emit EventBridge events, but they cannot perform EC2 actions or Auto Scaling actions. The following table summarises which actions each type of alarm supports.
| Action | Metric alarm | Composite alarm |
|---|---|---|
| SNS notification | Yes | Yes |
| Lambda function | Yes | Yes |
| Systems Manager OpsItem | Yes | Yes |
| EC2 stop, terminate, reboot, recover | Yes | No |
| Auto Scaling policy | Yes | No |
| EventBridge state change event | Yes | Yes |
The following diagram shows a composite alarm with a suppressor.

Reducing alarm noise
Recovering instances automatically
A legacy application runs on a single EC2 instance that cannot be placed in an Auto Scaling group. The company wants the instance moved to healthy hardware automatically after a host failure, keeping its Elastic IP address. The following alarm uses the recover action on the system status check.
aws cloudwatch put-metric-alarm --alarm-name legacy-app-recover \
--namespace AWS/EC2 --metric-name StatusCheckFailed_System \
--dimensions Name=InstanceId,Value=i-0123456789abcdef0 \
--statistic Maximum --period 60 --evaluation-periods 2 --datapoints-to-alarm 2 \
--threshold 1 --comparison-operator GreaterThanOrEqualToThreshold \
--alarm-actions arn:aws:automate:us-east-1:ec2:recover arn:aws:sns:us-east-1:111122223333:ops-alertsA second alarm on StatusCheckFailed_Instance with the reboot action covers problems inside the guest, such as a kernel panic. Recovery is not possible for instances that use instance store root volumes.
Can a composite alarm stop an EC2 instance or run an Auto Scaling policy?
Show answer
No. Composite alarms reduce noise and can notify, but EC2 and Auto Scaling actions need a metric alarm.
Exam Tips
Remember for the exam
- Metric alarms can notify SNS, perform EC2 actions, run Auto Scaling policies, invoke Lambda and create OpsItems.
- Start Systems Manager Automation or Step Functions from an alarm through an EventBridge rule.
- Composite alarms reduce noise but cannot perform EC2 or Auto Scaling actions.
- System status check failure: recover; instance status check failure: reboot.