Would you like to discuss your environment with a knowledgable engineer?
Once done, you will have a working auto scaling group that will work like in the little diagram below:
aiScaler -> one or more application instances
Then I will describe how you can remove all the configuration in case you want to delete it.
To use aiScaler as a Load Balancer with auto scaling you should use the Market Place AMI of aiScaler. For this go to Amazon EC2 Console and click on Launch Instance. In the appeared window select AWS Markeplcate and search for aiScaler in “Search AWS Marketplace” field. Then just follow the instructions to launch the instance like any other Amazon Instance, as it’s described here.
One note though, if you want to use aiScaler as a load balancer, I would suggest to use at least the Large instance to handle more traffic.
You will have to create an AMI that will contain all the software needed for your application and deployment scripts that will configure the application on boot. This is different for every application and I can not provide much support here, we can provide support for this separately, so if you like just drop an email to firstname.lastname@example.org and we will be happy to help.
The part that you need to add here, are two small scripts that will register with aiScaler on boot, and deregister with aiScaler on stop/terminate.
You can download and use the following simple scripts for the register and deregister purpose, aicache_connect.sh and aicache_disconnect.sh scripts are attached at the bottom of this page.
You need to have the key pair file to connect to your aiScaler instance copied into your application AMI and the path to this file should be set in the scripts as KEY_FILE variable.
Below are the variables from the script explained:
You also have to provide the IP address of aiScaler instance as user-data, so application servers know to which server they should register, this will be covered in the creating launch configuration section.
The last step here is to add aicache_connect.sh to run at boot and aicache_disconnect.sh to run at stop/terminate. For this you can do the followings on ubuntu machine:
The above will ensure that register is done on boot, and deregister is done on stop/terminate.
I strongly recommend testing that registration is working fine before going into production.
Select “Load Balancers” under “Network & Security” in the EC2 Management Console, and start the Create Load Balancer wizard.
Name your Load Balancer, and adjust the health checks for your web application, e.g. “/” instead of the default “/index.html”.
Do not add any instances to your load balancer, this will be done by the Autoscaling Group.
Using the AWS Console we’ll:
To start configuring Auto Scaling navigate to the EC2 Dashboard and select Launch Configurations under Auto Scaling.
Start the Auto Scaling Launch Configuration Wizard.
In Step 1 select My AMIs and locate the AMI you created at the previous step.
In Step 2 select your desired instance type, e.g. m1.large.
In Step 3 name your Launch Configuration, e.g. “AiScaler Launch Configuration”. Select Advanced Options, and in the User Data field input the private IP address of the aiScaler server. It is needed on the application servers so they know where to connect and register.
You can now skip to Review and Create Launch Configuration. The wizard will bring you directly to the Create Auto Scaling Group wizard.
In Step 1 name your group,e.g. “AiScaler Auto Scaling Group”, and select your Availability Zones, we recommend selecting them all.
Under Advanced Options, check “Recieve traffic from Elastic Load Balancer(s)”. Select the name of the ELB you created in the step before in the pull down menu.
In Step 2 we configure scaling policies. Select “Use scaling policies to adjust the capacity of this group”.
Next to Execute Policy when select Create alarm.
Unselect “Send notification to”.
Set the alarm to “Whenever CPU Utilization is >= 80 Percent”.
Next to Take Action select Add 1 instance.
Repeat for decrease policy size, selecting “Whenever CPU Utilization is <= 20 Percent”.
Skip to Review and Create Auto Scaling group.