autoscalinig-with-cloudwatch
README.md

autoscalinig-with-cloudwatch

This project demonstrates the use of CloudWatch alarm to automate scaling of instances on AWS. The services used in the demonstration include ... EC2 instances, Autoscaling group, CloudWatch.

The steps followed in the project include...

  1. Create a LaunchTemplate in the default VPC, and run a custom script to install nginx and the hostname of the server should be displayed on the browser when the server's IP address is visited.

  2. Create Autoscaling group using the LaunchTemplate. Omit autoscaling rule initially.

  3. Create 2 CloudWatch alarm - one for CPU usage above 70% and the other for CPU usage below 30%

  4. Create autoscaling rules in the Autoscaling group, one to scale out the instances when the first CloudWatch alarm condition is met (instance count is increased by 1), and the other rule to scale in the instances when the second alarm condition is met (instance count is decreased by 1). The desired instance count is 2.

  5. Once the whole set up is complete, the initial number of instances launched would be 2. After a while, this decreases to 1 due to under-utilization of the CPU. With increase in CPU to above the threshold of 70%, the count increases to 3.