Stimulating Failure Scenario for CLB
- Now for testing if the load to our EC2 web-server is getting equalling distributed or not let’s login to EC2 instance created and change the content of index.html page
- First login to CLB-instance-1 and run following
[code]sudo su
echo "Hello World From CLB-Instance-1" /var/www/html/index.html[/code]This will change the Hello World page to Hello World From CLB-Instance-1
- Similarly on second instance
[code]sudo su
echo "Hello World From CLB-Instance-2" > /var/www/html/index.html[/code]This will change the Hello World page to Hello World From CLB-Instance-2
- Now if you hit CLB DNS name should see traffic getting server from two different (do few browser refresh F5)
- Now from simulting the error scenerio lets remove health.html from CLB-instance-1, doing this since we have defined health.html page as our health check file
Run following commands on CLB-instance-1[code]cd /var/www/html
rm health.html[/code]
- Now if you hit CLB DNS name and hit few refresh on browser you should traffic getting server only from one instance
- And in CLB instance tab, CLB-instance-1 is marked OutOfService
- Delete everything now!