This project walks through setting up a basic Amazon EC2 instance and monitoring its CPU utilization using Amazon CloudWatch. You’ll create an alarm that triggers when CPU usage exceeds 15%, generate stress on the instance, and observe CloudWatch in action.
- AWS account
- IAM user with EC2 and CloudWatch permissions
- AWS CLI configured (optional)
- Basic knowledge of EC2 and Linux commands
- Launch a t2.micro EC2 instance in the default VPC with a public IP.
- Connect to the instance and install required packages.
- Create a CloudWatch alarm to monitor CPU usage.
- Generate CPU load using
stress. - Observe the CloudWatch alarm trigger and reset.
- Clean up AWS resources.
- Instance Type:
t2.micro - VPC: Default
- Public IP: Enabled
- Monitoring: Detailed monitoring (optional, small fee may apply)
SSH into your EC2 instance, then run:
sudo yum install stress -y
stress -c 1 -t 3600- Configure EC2 instance and Create CloudWatch security group
- Verify EC2 instance and make sure it clears status checks
- Configure CloudWatch Alarm
- Connect to EC2 Instance (In this scenario, I used EC2 Instance Connect)
- Install the stress package
The alarm is currently in a 'OK' state
- Pre-CPU stress. The CPU utilization right now is showing the stress install
- Run stress from EC2 instance. After a couple minutes the state will move from 'OK' to 'In Alarm'
- Stop the stress program and monitor CloudWatch. It should be move back to 'OK' after several minutes.
- Cleanup resources (Delete CloudWatch alarm, EC2 Instance and CloudWatch Security Group)



















