Prerequisites
Ensure you define the
LatestAmiId parameter before deploying the stack. For example:CloudFormation Template Overview
This CloudFormation template provisions the following AWS resources:Core Resources
CloudWatch Alarms Definition
Outputs
Although the ASG can scale up to 20 instances, our threshold is set at >10 for demonstration.
Deploy the CloudFormation Stack
- Open the AWS CloudFormation Console.
- Choose Create stack > Upload a template file, and select your
composite_alarm.yaml.

- Click Next, set Stack name to
CompositeAlarmInfra, and keep default parameters.

- Submit and wait ~4–5 minutes until status is
CREATE_COMPLETE.

- On Outputs, copy the AutoScalingGroupName.

Verify CloudWatch Alarms
Navigate to CloudWatch > Alarms. You should see:- HighASGSize
- HighCPUUsage
- VeryHighCPUUsage
OK or Insufficient Data.


Create the Composite Alarm
- Select the three child alarms.
- Go to Actions > Create composite alarm.
- Define the rule:
- Configure notifications (e.g., an SNS topic) and an optional suppressor alarm.

- Enter Name and Description (Markdown supported).

OK state.

Test the Composite Alarm
To trigger the alarm:- In the EC2 Console, open your ASG > Details > Edit.
- Set Min and Desired capacity to
12, then save.



Cleanup
- Delete the CloudFormation stack.

- In CloudWatch, select the composite alarm and choose Actions > Delete.
Deleting the composite alarm must be done manually—it is not removed by the CloudFormation stack.