Autoscaling experiment
-
I have created an instance template with lamp image and instance size e2-medium (2VCPUs and 4GB of RAM)

-
Now lets create a instance group with minimum 1 instance and maximum 5 instances

-
Now lets wait for the instance group to be launched and then create a load balancer

-
Lets create a load balancer

-
Now lets access the application using loadbalancer ip

-
Now lets create artifical load on the cpu, for that lets login in to the vm and execute stress commands

stress --cpu 8 --vm 2 --vm-bytes 128M --timeout 100m -v

- Now lets try to stop the stress command and see if the servers come down Wait for atleast 10 mins

- Number of instance were decreased as load on cpu decreased
- Exercise:
- Create a gcp image with tomcat 8 installed Refer Here
- Also install stress
sudo apt install stress -y- tomcat runs on port 8080
- Now create an instance template with 2 VCPUs and 4 GB of RAM
- Now create an instance group (min 1 and max 2) and a load balancer
- Ensure you create port mapping in instance group with 8080
- loadbalancer frontend port 80 and backend port 8080

