-->

Wednesday, June 1, 2016

Autoscaling Important points Consideration

While going into the Autoscaling Environment setup in the Amazon AWS , you should keep a note of the following things in order to build a better dynamic environment


  • Always tag the instances while creating the Autoscaling group so that all the instances which would come up from the autoscaling group have the tags associated with them so you can easily find them while looking on the console.

  • If you are using the session persistence you can handle the session either from the AWS ELB or from the server. If you select AWS ELB , ELB would manage your session on the basis of the time duration specified. If you consider using the server session than roundrobin algorithm used by the ELB won't work effectively. To overcome this problem save the session in the database and using a memcache or some other caching for the session. This will prevent the overloading of any particular instance.

  • If you are using some configuration management tools which builds up your instance and deploys your stack and code as the new server comes up than you can take the advantages of the hooks provided by the AWS. This comes under the autoscaling lifecycle. There are both the pre and post hooks i.e. you can introduce a predefined delay before the instance gets attached to the ELB and start serving traffic. Similarly you can setup  a delay in which case instance would get de-register from the ELB so traffic won't come on them before actual termination. This is particularly helpful if you want to take out something from the server before termination.

  • You can directly query the Autoscaling group and write your own code so that the instance which is going to terminate can identify its going to terminate and as this situation occurs it executes a pre-defined script which active your tasks before the termination.

  • You can create a list of the users on the S3 and using your custom code handle the user creation and deletion dynamically from the instances itself. Following lists should do the work , a user-create list, user-delete lists and  keys of the users which gets added in the server via scp so that they can login to the server using there key. You can make use of the Autoscaling bootstrap of the ec2 instances to trigger it everytime on autoscaling. The advantage is that you only need to add a username and it will get replicated on all the new instances coming up. Similar with the user account deletion as well.

  • You need to restart the rsyslog service as the instance comes up. You can define this both in the server image or the bootstrapping of the node. The problem is if you don't do this the /var/log/secure file would keep on showing the base image ip as the state persist in it. It won't be able to detect the new server ip and if you are sending these logs to your security team this would create a issue again.

  • If you want to delete the launch configuration or autoscaling group the best way is to introduce a tag into it and create a script so that it recognizes your tag and delete the associated id.

  • For determining of the ips  running under a loadbalancer at a period of time you can directly query the ELB which would provide you the istance id and from the instance id you can have the instance ip which can again be consumed from some other script or you can take it in text document. Same could come handy if you want to setup the monitoring on the autoscaling servers.

  • Always tune your apache to use the less memory than what is available because default values might make the instances unavailable. And if you are using the default monitoring of 5 minutes and instances are becoming unavailable than you autoscaling would not work in such scenario because new instances would beome unavailable and needed instances won't be available for handling the load.

  • Always monitor the used instances and the maximum available instances in the autoscaling and make sure maximum available instances are always more than the used instances for the autoscaling to work in an effective manner

0 comments:

Post a Comment