AWS Auto Scaling
AWS Auto Scaling Group
AWS Auto Scaling monitors your applications and automatically adjusts capacity to maintain steady, predictable performance at the lowest possible cost. Using AWS Auto Scaling, it’s easy to setup application scaling for multiple resources across multiple services in minutes.
How to Configure Auto Scaling Group
In EC2 Console go to Auto Scaling Configuration
if there are no ASG configured, you will find the above flash page and to create ASG click on the create Autoscaling group button.
Auto Scaling Group having two main components to configure
- launch Configuration
- Auto Scaling Properties
if you have not created a launch template then to create template click on create launch Template
Launch Template: Launch templates enable you to store launch parameters so that you do not have to specify them every time you launch an instance. For example, a launch template can contain the AMI ID, instance type, and network settings that you typically use to launch instances.
to create a launch template pass the parameters like AMI ID, Instance Type, SSH Key, Security Group, UserData.
here we have added user data for HTTP server installation. (each new instance created with auto-scaling activity will take the default configuration as user-data passed through launch template)
#!/bin/bash
yum install -y httpd.x86_64
systemctl start httpd.service
systemctl enable httpd.service
echo “WelCome to AS
Post-launch template creation, you need to select from the drop-down button (you can see the launch template config details).
Auto Scaling Group configuration with VPC and Subnets
with Auto Scaling Group Configuration we can select existing Load Balancer or we can create New (of course you can choose none if you don't want to configure), here you can select LB type ALB to NLB and load balancer other properties like a load balancer scheme, VPC, Subnet.
other load balancer properties like target group, health check, and cool-down period.
Scaling Group size and scaling policy configuration.
Minimum Capacity: This is the minimum number of instances that have to be there in your Autoscaling Group at all times. Your autoscaling group always maintains this number and never terminates instances below this number.
Maximum Capacity: This is the maximum number of instances that your autoscaling group can have. Your autoscaling will never increase the number of instances more than the specified Max number.
Desired Capacity: The desired amount represents the “current amount” of instances in your autoscaling group. An autoscaling group will start by launching as many instances as specified as the desired capacity. When scaling policies are set, the desired capacity is adjusted between the minimum and maximum amount.
Desired capacity should be set greater than or equal to the min value and less than or equal to the max value.
Review All configuration for ASG.
Auto Scaling Group Created.
Auto Scaling Group Configuration review, Edit, or delete can be done from here.
On the Activity tab, under Activity history, the Status column shows whether your Auto Scaling group has successfully launched or terminated instances. here you can see the new instance launched.
Load Balancer created with ASG (review configuration)
Access DNS to access HTTP server configured in ASG launch Template
Auto Scaling Policy
Add Scaling Policy from Automatic Scaling Tab.
Scaling policy types
Amazon EC2 Auto Scaling supports the following types of scaling policies:
- Target tracking scaling — Increase or decrease the current capacity of the group based on a target value for a specific metric. This is similar to the way that your thermostat maintains the temperature of your home — you select a temperature and the thermostat does the rest.
- Step scaling — Increase or decrease the current capacity of the group based on a set of scaling adjustments, known as step adjustments, that vary based on the size of the alarm breach.
- Simple scaling — Increase or decrease the current capacity of the group based on a single scaling adjustment.
Creating Target Tracking Policy here with metric type is the CPU utilization of 50%
Policy Review, from this page user, can delete exit policy
Cloud Watch Alarm will be created with Target Tracking Policy.
Updating Desired Capacity to test Target Tracking Policy.
Updated Desired Capacity, this will add new Instance in Activity, you can see the new instance added so now there are 2 instance should be running.
New Instance added and it's running
Cloud Watch Alarm triggered with continuous CPU utilization down with threshold.
CPU Utilization of Instance.
with Policy Trigged instance removed the same you can see in activity
Validate Instance drained
This is the complete guild for how to configure Auto Scaling Group with LB & Policy
Impressive Blog Post. Thanks alot for eforts you put in writing such a nice post on AWS Online Training. Good Luck and Thanks
ReplyDeleteI would like to visit your site again from now on.Thanks for sharing this here Facebook bellen
ReplyDelete