Auto Scaling Groups and Launch Configurations

  1. What is auto scaling group?
    1. Auto scaling groups along with Launch Configurations enable you to create a logical group of EC2 instances that are always available.
    2. ASGs optionally work with ELBs but ELB is not needed for ASG to work.
  2. What is Launch Configuration or Launch Template?
    1. ASG uses launch template, or a launch configuration (not recommended, offers fewer features), as a configuration template for its EC2 instances
    2. Is a recipe to create an EC2 instance. Steps involved are exactly same as creating an EC2 except at the end you will create the recipe as opposed to launching the actual instance.
    3. Launch templates have versions. Launch configs do not.
  3. Create Launch Configuration
    1. Choose AMI
    2. Choose Instance Type
    3. Name the launch config
    4. Choose spot instances or not
    5. Choose if you need detailed monitoring on cloud watch
    6. Choose IAM roles if any
    7. Input the User data (bootstrapping code) if any
    8. Any ip address related parameters
    9. Add storage details
    10. Security Group details (default or your own)
    11. Input your key pair name
    12. Click save the launch configuration
  4. Create Auto Scaling Group. (This will launch the EC2 instances)
    1. Name of the auto scaling group
    2. Choose VPC
    3. Choose Group size (starting number of instances)
    4. Choose subnets (one or more. Its a multi select. Better to choose two or more AZs). The instances from above step will be distributed evenly among the chosen AZs
    5. Choose Launch Configuration
    6. Choose optional Load Balancer
    7. Choose which health check to use (ELB or EC2)
    8. Input health check grace period (300 sec default). This is the amount of time the ASG waits before it checks the health of a newly started instance. If you have major bootstrapping script, increase this parameter.
    9. Scaling Policies
      1. Scaling policies enable you to either keep the group size constant at th initial size or
      2. Scale between min and max instances (min and max are not equal to initial size)
      3. Increase Group Size Rule
        1. Execute policy when (Points to an Alarm. Alarm has following)
          1. Name of the alarm
          2. Whenever: Average/Min/Max of CPU/RAM >/</>=/<=   XXXX percent.
          3. At least: N number of consecutive periods of T sec/min
          4. Optional SNS notification
        2. Take the action:
          1. Add/Substract
          2. N instances
          3. Warm up time (300 sec)
      4. Similarly Create Decrease Group Size Rule
      5. Provide optional email to be sent when launching/termination/fail to launch/fail to terminate instances
    10. Finally click to “Create ASG”. This will immediately launch the EC2 instances as per the rules of the ASG
    11. Remember: Security Group is input for the launch configuration whereas VPC/subnets/AZs are parameters of the auto scaling group.
    12. The default termination policy is designed to help ensure that your network architecture spans Availability Zones evenly.
      1.  Auto Scaling determines whether there are instances in multiple Availability Zones. If so, it selects the Availability Zone with the most instances and at least one instance that is not protected from scale in.
      2. If there is more than one Availability Zone with this number of instances, Auto Scaling selects the Availability Zone with the instances that use the oldest launch configuration.
    13. If you suspend AddToLoadBalancer, Auto Scaling launches the instances but does not add them to the load balancer or target group. If you resume the AddToLoadBalancer process, Auto Scaling resumes adding instances to the load balancer or target group when they are launched. However, Auto Scaling does not add the instances that were launched while this process was suspended. You must register those instances manually.
    14. Auto Scaling periodically performs health checks on the instances in your Auto Scaling group and identifies any instances that are unhealthy. You can configure Auto Scaling to determine the health status of an instance using Amazon EC2 status checks, Elastic Load Balancing health checks, or custom health checks
    15. The thumb rule is, if any instance reported unhealthy either by Auto scaling health check or any ELB instance check (In case of multiple ELB), Auto scaling will consider worst case scenario and always mark instance unhealthy and remove it.
<<< Elastic Load Balancer (ELB)Elastic File System (EFS) >>>
Copyright 2005-2016 KnowledgeHills. Privacy Policy. Contact .