Auto Scaling Groups
Welcome to CloudAffaire and this is Debjeet
In the last blog post, we have discussed Launch Configuration and created a new Launch Configuration.
In this blog post, we are going to discuss Auto Scaling Groups. We are also going to create an Auto Scaling Group using Launch Configuration.
Auto Scaling Groups
Auto scaling groups provides the facility to scale in or scale out your EC2 instances as per your requirement. An auto scaling group consist of a collection of EC2 instances that share similar characteristics and are treated as a logical grouping for the purposes of instance scaling and management.
Auto scaling group helps you to meet your desired instance count. When you create an Auto scaling group, you define the number of instances and auto scaling make sure that this number is maintained. Auto scaling group maintains this number of instances by performing periodic health checks on the instances in the group. If an instance becomes unhealthy, the group terminates the unhealthy instance and launches another instance to replace it.
You can use scaling policies to increase or decrease the number of running EC2 instances in your group dynamically to meet changing conditions. When the scaling policy is in effect, the Auto Scaling group adjusts the desired capacity of the group and launches or terminates the instances as needed.
Create an Auto Scaling Group
Step 1: Login to AWS console and click ‘EC2’ under compute.
Step 2: Navigate to ‘Auto Scaling Groups’ located under AUTO SCALING and click ‘Create Auto Scaling group’.
Step 3: Select an existing Launch Configuration and click ‘Next Step’.
Note: You can create an Auto Scaling Group using a Launch Configuration or a Launch Template. If you are using a Launch Configuration, you cannot change the launch parameter in future. In this demo, we are going to use Launch Configuration.
Step 4: Provide a name, size and network details and scroll down for additional options.
Note: You can configure your load balancer with auto scaling, define the health check interval as per your launch configuration. Since Auto Scaling Group required to launch and terminate instance access, AWS creates a new service role ‘AWSServiceRoleForAutoScaling’. We are not going to change anything in this section, click ‘Configure scaling policies’.
Step 5: Select ‘Keep the group at its initial size’ and click ‘Next: Configure Notifications’.
You can optionally add scaling policies if you want to adjust the size (number of instances) of your group automatically. A scaling policy is a set of instructions for making such adjustments in response to an Amazon CloudWatch alarm that you assign to it. In each policy, you can choose to add or remove a specific number of instances or a percentage of the existing group size, or you can set the group to an exact size. When the alarm triggers, it will execute the policy and adjust the size of your group accordingly. Auto Scaling Policies will be covered in details in Auto Scaling Series. Hence we are not going to creating any policy in this demo.
Step 6: Add an email notification for your auto scaling group and click ‘Next: Configure Tags’.
This is optional and if you want, you can skip notification.
Step 7: You can add a tag to identify your group. Provide Key and Value for your tag and click ‘Review’.
Review Auto Scaling Group configuration and click ‘Create Auto Scaling Group’.
One success message will be displayed, click ‘View your Auto Scaling groups’.
A new Auto Scaling Group along with the target instance successfully created.
To view the instance, navigate to ‘Instances’ located under INSTANCES
If you terminate this instance manually, Auto Scaling Group will create another instance after the next health check. To completely remove all instances related to auto scaling, remove your auto scaling group.
Hope you have enjoyed this blog post. In the next blog, we are going to discuss EC2 instance monitoring using CloudWatch.