Last article we studied how to load balance our servers so that we can make them more reliable but adding servers manually still make our system brittle. At any time the load on our servers may increase. So, we need to set our servers in such a way that servers are added and removed automatically. This is what auto scaling groups are used for in AWS.
In the cloud you can create and get rid of serves very quickly and we don't know what kind of a load will be on our server. So, in order to ensure an optimum number of server quantity we use auto scaling groups. ASG adds EC2 instances and removes EC2 instances according to need. ASG automatically registers new EC2 instances as and when needed on the load balancer. It can also detect unhealthy instances and add new servers replacing them. This leads to cost savings and a robust system architecture.
In an ASG we give a minimum capacity, a maximum capacity and a preferred capacity. Our ASG starts from a preferred quantity and add or remove servers according to need. It registers all of them under a load balancer so that we can still take the advantage of one common DNS for all our servers, plus traffic is automatically balanced across our servers.
In the next article we will see how to create a robust architecture in our EC2 instances using our load balancers and auto scaling groups.