An Auto Scaling group is a collection of Amazon EC2 instances that are treated as a logical unit. You configure settings for a group and its instances as well as define the group’s minimum, maximum, and desired capacity. Setting different minimum and maximum capacity values forms the bounds of the group, which allows the group to scale as the load on your application spikes higher or lower, based on demand. To scale the Auto Scaling group, you can either make manual adjustments to the desired capacity or let Amazon EC2 Auto Scaling automatically add and remove capacity to meet changes in demand.
Prerequisite: Having a valid AWS Account (Follow the step in this link to create an AWS Account) How to Sign Up for a new Amazon Web Services Account
Open the page: https://aws.amazon.com/account/
From previous lab on load balancing, terminate all the EC2 instance currently running
Select all EC2 instances and click on terminate instance
Confirm by clicking on Terminate
Go to the menu and select Auto Scaling groups
Click on Create Auto Scaling group
Enter the Auto Scaling group name and Create a Launch template / Click Next
Enter the Launch Template name and choose the options for your EC2 template (AMI image / Instance type / Key pair / Network settings / Storage and User data)
Review all the option and click on Create launch template
Confirm the template was created and go back to your auto scaling wizard
Choose the new template and click Next
Select the Availability Zones and subnet / Click Next
Choose Attach to an existing load balancer / Select the existing Target Group / or create a new one
Click on Next
Configure the group size and scaling policies / Click on Next
Click on Next
Click on Next
Review all the steps and click on Create Auto Scaling Group
Click on Instance Management to view the details on instances
Confirm you have now two new instances created by ASG
Open your load balancer url and confirm you have access to the web application
Terminate one instance and see how ASG automatically provision a new instance
Play with the ASG desired capacity (1) and maximum capacity (2) to see how the ASG is working by auto-provisionning new instances or terminate unnecessary instances
Lab cleaning up
Select the Auto Scaling group and delete it
Confirm the deleting action
Select Load balancer and delete it
Confirm that all the EC2 instances was terminated
Credit: Stephane Maarek
Leave a Reply