How to Setup AWS Auto Scaling

How to setup AWS Auto Scaling?

Objective

The objective of setting this AWS auto-scaling lab is to ensure that your application can handle network traffic by automatically adjusting the number of EC2 instances that are running. AWS AutoScaling allows scale resources up or down through a pre-defined threshold, which helps you only pay for the resources you actually need.

Prerequisites for this lab

Steps by step guide for setup AWS Auto Scaling

  1. Login to your AWS Console and navigate to the EC2 service.
  2. Click on the “Auto Scaling Groups” option from the left-hand menu.
  3. Click on the “Create Auto Scaling Group” button to start the auto-scaling group creation process.
    auto_scaling_home
  4. Give an auto scaling group name and click on the “Create a launch template”).
    auto_scaling_create
  5. Give a name and description for launch template.
    launch_template_create
  6. Configure AMI for your application (Webserver).
    launch_template_os_image
  7. Configure instance type asper your need.
    launch_template_os_instance_type
  8. Configure Key pair, Security group and Network settings.
    launch_template_keyPair_Network
  9. Configure EBS storage volumes and click on the “Create launch template”.
    launch_template_ebs_storage
    A launch template will be created.
    launch_template_created
  10. Now, Go back to the screen “Create Auto scaling group”. Click on the refresh icon to get created launch configuration and select that launch template. After configuration click on the “Next”
    auto_scaling_lt_config
  11. Choose the Network and subnet(s) configuration where you want to launch the EC2 instances.
    You can select multiple subnets to ensure high availability. After configuration click on the “Next”
    auto_scaling_network_config
  12. Optional step: Create or attach a Load balancer or target group to distribute traffic across instances.
    You can check here – How to setup AWS application load balancer.
    Additionally, you can define the health check type and the grace period (for example 60 second) for EC2 instances to initialize before being marked as healthy or unhealthy. After configuration click on the “Next”
    auto_scaling_load_balancing_config
  13. Setup the minimum, maximum, and desired number of EC2 instances that should be running at any time.
    auto_scaling_group_size_config
  14. You can define scaling policies if required. Target tracking scaling adjusts the number of instances based on a predefined metric, while step scaling adds or removes instances based on thresholds that you define.
    For example, Here for metric type “Average CPU utilization” the target value is 50 defined. After configuration click on the “Next”
    auto_scaling_policy_config
  15. Optional step: Add notification, Add Tags (skipping for this lab). Click on the “Next”
  16. Review your all configuration and click on the “Create Auto Scaling group” button
  17. After you have created your auto-scaling group, AWS will automatically launch desired EC2 instances based on your defined scaling policies. You need to wait for some time and refresh your EC2 instance dashboard.
    auto_scaling_created
    auto_scaling_ec2_created
  18. To validate the AutoScaling configuration, let’s terminate one instance after sometime (using health check configuration), AutoScaling will automatically create a new instance to meet your configured desired capacity of instances.
    auto_scaling_ec2_re-created

Note: Make sure to delete all the AWS resources created for this lab to avoid unnecessary charges.

How to Setup AWS Auto Scaling
Scroll to top