Autoscaling (contd)
- Now login into to the linux to create artificial load
stress --cpu 8 --io 4 --vm 2 --vm-bytes 128M -v --timeout 100m
- Create one more login session (ssh into the same machine using other terminal)
htop
-
As number of ec2 instances increases, sharing the public ip of every ec2 is not a feasible option, so we deal with loadbalancers.
-
In AWS, there are three types of loadbalancers.
- Classic Load balancer (Layer4 and Layer 7)
- Network Load Balancer (Layer4)
- Application Load Balancer (Layer7)
-
So lets create a load balancer ( I will be using a classic load balancer)
-
Loadbalancer needs to be connected to autoscaling group
- Navigate to auto scaling group
- Configure load balancer by editing the auto scaling group
-
Navigate to the loadbalancer
-
Users access my application using Loadbalancers DNS A Record e.g
http://qtcommerce-962571469.us-west-2.elb.amazonaws.com/info.php
-
Now you can add this entry to DNS Servers (if internal to your organizational) or use an AWS Service called as Route 53 to map your domain to Auto Scaling Group
-
You can acheive the same thing with Application loadbalancer and that is your exercise.
-
After your practice ensure the following are deleted (as they are not free)
- Loadbalancers
- Auto Scaling groups
- Target groups (if any)
- AMI (Snapshots use storage)