How To Configure Autoscaling Setup On Amazon Cloud

How To Configure Autoscaling Setup On Amazon Cloud

AutoScaling is a method to monitor your application and automatically adjust the capacity to maintain the steady-state. we need to define when the server should be launched. when the CPU load goes above certain %. How To configure AutoScaling, we nee

Two types of Scaling:

  1. Vertical
  2. Horizontal

Check Out: How To Install Sentrifugo Open Source HR Management Tool On Linux

Vertical scaling: we can increase CPU and RAM but we will have to reboot the machine.

Horizontal scaling: we can increase no of servers and will automatically attach to ELB. It works on a cloud watch.

Note: We will have to create a launch configuration to perform autoscaling. We will require shared storage for autoscaling like EFS or NFS.

This all configuration should be of running server and everything should be the same.

  1. We need AMI of servers
  2. VPC network
  3. Security group
  4. Instance type

Check Out: How To Extend LVM For Volume Group Size On Linux

Create an Alarm:

First of all, Now we will create an alarm for High and Low CPU usage.

Create a policy for the auto-scaling group for up and down the servers. Let’s start by creating an alarm for running the server.

Instances -> click on Monitoring

Ho To Configure Autoscaling

Before configuring autoscaling. I will create an alarm for servers and Now click on Create Alarm.

If the server load goes above 70 % CPU usage, it will send me an alert.

auto scaling in aws

In a similar way, if CPU Usage goes down 40 %, it will alert me.

configure auto scaling aws

Check Out: Windows Screen lock Automatically Using Group Policy

Steps to launch template:

Now I will take backup of the server, EC2 -> select server -> Actions -> images -> Create image

aws auto scaling group

Click on Create image and give it a name

setup auto scaling aws

You can see created images under AMI-> images

configure auto scaling aws

We have image backup and now I will create a launch configuration for autoscaling.

EC2 -> Auto scaling -> Create launch configuration

aws auto scaling launch configuration

It will ask you the AMI image, I have selected the image which I created.

Check Out: How To Create CSR Certificate File Using Command On Linux

Now, this will ask for volume group and I’m keeping it as free tier.

If you need to enable a cloud watch, you can do this here.

Add the volumes.

Select your security group.

Review the configuration and then click on the Create launch configuration. You have created a launch configuration successfully.

Check Out: How To Create Swap file Without Disk Partition On Linux

Configure the Auto-Scaling Group:

Auto-scaling -> Click on auto-scaling group

Now Scroll down and select your image

You have to create an auto-scaling group and choose the required filed according to your needs. You can select group size means how many servers you want to launch.

Click on Advanced and select your ELB.

Now select Use scaling policies to adjust the capacity of this group

You have to select your auto-scaling policy for increased group size.

You can change instances to launch. In my case, 2 instances will be launched if CPU usage goes higher than 75 %. You can set more CPU utilization by clicking on the additional step and define the % of CPU. according to the alarm set, these will launch and delete the instances automatically.

Check Out: How To Solve Sentrifugo PHP Mailer Autoloader Error On Linux

Now we will define when CPU usage goes to 45 %, delete the launch instances.

Configure alert notification and choose your mails.

Configured successfully.

You’re done 

About Helios Smith

Author is a avid reader

Latest Posts
Follow Us
Get the latest news delivered daily!