Exercise-1 Create a Cloud Watch Alarm to Stop Ec2 Machine when CPU Utilization < 5
- Create an Ec2 Instance
- Create an alarm for CPU Utilization < 5 for 5 minutes
- Add an EC2 action to stop(shutdown) the Ec2 instance
- Wait till the alarm is raised and observe ec2. Ec2 instance should be stopped
Exercise-2 Create a Cloud Watch Alarm which reboots the EC2 instance when CPU Utilization = 100 for 5 minutes
- Create an Ubuntu Ec2 Instance.
- SSH into Ubuntu Instance and execute the following commands
sudo apt-get update
sudo apt-get install stress -y
stress --cpu 8 --timeout 100m -v
- Create an alarm with above spec to reboot ec2 instance
Exercise-3: Create a Cloud Watch Alarm which terminates the EC2 instance when CPU Utilizations is < 20 for 120 minutes
Simple Notification Service
- Email Notifications using SNS
- Create SNS Topic
- Each Topic has subscriptions. Create an Email Subscription.
- Confirm the Subscription.
- For all the above exercise send the notification to topic.