Lab 9 Enabling Auto Scale to Handle Spikes and Troughs
Auto Scaling helps you to maintain application availability and allow to scale your Amazon EC2 capacity up or down automatically according to condition of your define. So by using this Auto scale we make sure what ever we need EC2 instance they all are running. It is also possible to increase the number of Instance on the base of traffic if the traffic is high then the number of instance will automatically increase and if the traffic will going down then the number of instance will automatically decrease.
This lab Will cover following steps which is as bellow,
- Create Launch Configuration for existing EC2 Instance
- After that Add that configuration in to a auto scaling group
- Maintain the total number of the Instance will create automatically
- Check if one of the Instance fail
You can check the case if some of the instance will fail for some reason, by using auto scaling group a new instance will be created automatically to manage a complete traffic.
Step 1. To create Auto Scaling just create a some configuration for the Instance, for that click on Services on the AWS main console and click on EC2 services in compute,
After that just click on Launch Configuration tab on the left hand side of the panel of the EC2,
Now You are in the main page of the Auto Scaling, click on Create Auto Scaling Group,
To create a group You have to create some configuration for that group, click on create launch configuration,
In here you are not going to create a new instance, click on My AMIs and you are able to see your active instances and select any of them and press next,
After that here are same steps while you created a EC2 instances. Select Instance type,
Name of the configuration and by using which IAM role you want to create, select a appropriate one,
After that select a storage for this Instance,
After all that above configuration just select a security group from existing so both instance will be in the same group that will be better,
Select a existing key for login for this instance also to make this easy just select a existing one which is also use for previous instances,
Step 2. After making a basic configuration now You are going to create a auto scaling group. In here you declare how many instance you want to auto create and for which network and subnet. Also for which load balancer, you are going to maintain all the things
In this step I am going with Initial Size but if need go with some policies to manage this,
By using a second option you will fix some conditions like when and how many instance will be create and when they will be kill to manage a traffic according to the incoming flow.
After complete all the process just go to the load balancer and check how many Instances are there in the services,
Also check on the Instances of EC2 page, you can see there are two new instances add automatically by Auto Scaling process,
Step 3. Browse an application in to the browser and note that server IP address it will be a different in every refresh,
For Some case I am going to terminate one main Server and refresh a application and not server IP again,
Again I terminated other Instances from the EC2 and again create a same case is there any effect on the application,
By using Auto Scale feature in EC2 instance we make sure anyhow our application never going out of service or something like that. If one of the instance will fail at the same time by using this feature a new instance will be generate and put in the same point to balance a complete application.
For Auto Scaling Process there is not additional charge because you are going to create a EC2 instance so the charges will be same what you pay for the EC2 instance.
To manage a cost make sure when and how many instance you need to create and after complete a work how many instance and when it will be killed, put that condition so it will beneficial else if you do not put this condition then the cost will be increase continuously and you have to pay what you never use.