Table of Content
Why is Auto scaling best practice?
Step 1: Create your own AMI
Step 2: Creating a Launch template
Step 3: Creating Auto Scaling group for 1 instance.
Step 4: Auto Scaling group verification
What is Auto Scaling?
It is an amazon service which automates the process which enables clients to scale cloud services for example website, virtual machines or servers OS automatically. The client is offered features that allow lower cost, worry free performance as the traffic increases. Autoscaling will make the decision and move around the incoming traffic to divide the load on just one server.
Prerequisites
To create the Free Tier AWS we will need following;
AWS Account
Name of Autoscaling group
The hardware requirement
AMI (ISO)
Amount of Instance Available and dormant.
Why is Auto scaling best practice?
There are many reasons why Autoscaling is best practice
Save on cost when the resources are not being used they will be put to sleep.
Security is also biggest with this service client won’t have to worry about the security AWS will handle for the clients.
AWS auto scaling high availability is also reliable and assures clients that their service will not be impacted if implemented correctly, minimizing downtime for their data availability to their users.
Step 1: Create your own AMI
To create your own AMI for testing, we will need an existing EC2 Instance.
Navigate to the existing EC2 Instance and select the instance and click on Actions. Select the Image and Templates option from the drop down menu.
Select Create Image option.
Once on the Create Image page, enter the Image name, and short description to help identify the purpose of the image. Click on the Create Image button next.
The new AMI will show up under AMI (Amazon Machine Images). It will take a few minutes, but you will have you ami..
Step 2: Creating a Launch template
Navigate to or search for EC2 Service and scroll down, locate Auto Scaling Groups under Auto Scaling
Give Autoscaling group a Name “Demo-ec2”
Open Launch Template page or click on Create a launch template
Enter the launch template name as it is required
Choose the AMI we just created above.
Choose the Instance type, for demo we will be using t1.micro
Keep everything else as default
Generate a key pair.
Click on Create launch template
Step 3: Creating Auto Scaling group for 1 instance.
Navigate to or search for EC2 Service and scroll down, locate Auto Scaling Groups under Auto Scaling
Give Autoscaling group a Name “Demo-ec2”
Click on option Switch to launch configuration, to select our own AMI.
Click Next.
Select the VPC and All the Availability Zones and Subnets, under Choose instance launch options
Click on Next
On the Configure advanced options page, we will change the Health checks to 20 se and Click Next.
Note: This will wait and try to reestablish connection to corrupted instance before deciding to bring in the replacement instance in its place.
Under the Configure group size and scaling policies, we will choose to keep 2 instances running at all times. We will choose 1 for minimum capacity and 5 total in capacity for this demo
Click Next and Create the group after reviewing all the changes are correct.
Step 4: Auto Scaling group verification
After sometime we can see that there are two instances running and being managed by autoscaling group policy we created.
We can also confirm the autoscaling group in effect under the activity tab
Select the Autoscaling group and tab below it select the activity to see the logs or the state of Autoscaling group.
Step 5. Test Autoscaling
In order to test if the autoscaling will do what we defined, we will delete one instance from the demo production and in about 20 seconds. The autoscaling group should kick in to replace the missing instance.
Pre deletion Activity
Logs:
After deletion Activity
You should notice that when the termination or instance unavailable was detached. The autoscaling group stepped in to save the day. It also made sure that the same exact specifications are available in the new instance as well.
Note: If you would like to stay on Free Tier, make sure to delete the autoscaling group as well. Simply terminating the instance won’t delete the instance. The policy will kick in and bring back another instance.
Comments
Post a Comment