zoukankan      html  css  js  c++  java
  • [AWS

    The gola of an Auto Scaling Group (ASG) is to:

    • Scale out (add EC2 instances) to match an increased load
    • Scale in (remove EC2 instances) to match a decreased load
    • Ensure we have a minimum and maximum number of machines running
    • Automatically Register new instances to a load balancer

    Atttributes

    • A launch configuration
      • AMI + Instance Type
      • EC2 User Data
      • EBS Volumes
      • Security Groups
      • SSH Key Pair
    • Min Size / Max Size / Initial Capacity
    • Network + Subnets information
    • Load Balancer Information
    • Scaling Policies

    Auto Scaling Alarms

    • It is possible to scale an ASG based on CloudWatch alarms
    • An Alarm monitors a metric (Such as Average CPU)
    • Metrics are computed for the overall ASG instances
    • Based on the alarm:
      • We can create scale-out policies (increase the number of instances)
      • We can create scale-in policies (decrease the number of instances)

    Auto Scaling New Rules

    • It is possible to define "better" auto scaling rules that are directly managed by EC2
      • Target Average CPU usage
      • Number of requests on the ELB per instance
      • Average Network In
      • Average Network Out
    • There rules are easier to set up and can make more sense

    Auto Scaling Custom Metric

    • We can auto scale based on custom metric (ex: number of connected users)
    1. Send Custom metric from application to EC2 to CloudWatch (PutMetric API)
    2. Create CloudWatch alaram to react to low / high values
    3. Use CloudWatch alaram as the scaling policy for ASG

    ASG Brain Dump

    • Scaling policies can be on CPU, Network... and can even be on custom metrics based on schedule (if you know your visitor patterns)
    • ASGs use Launch configurations or Launch Templates (newer)
    • To update an ASG, you must provide a new launch configuration / launch template
    • IAM role attached to an ASG will get assigned to EC2 instances
    • Having instances under an ASG means that if they get terminated for whatever reason, the ASG will automatically create new ones as a replacement.
    • ASG can terminate instances marked as unhealthy by an LB (and hence replace them)

    Scaling Policies

    Target Tracking Scaling

    • Most simple and easy to set-up
    • Example: Iwant the average ASG cup to stay at around 40%

    Simple / Step Scaling

    • When a CloudWatch alarm is triggered (CPU > 70%), then add 2 units
    • When a CloudWatch alarm is triggered (CPU < 30%), then remove 1 unit

    Scheduled Actions

    • Anticipate a scaling based on known usage patterns
    • Example: increase the min capacity to 10 at 5 pm on Fridays

     

    Server Name Indication

    • SNI solves the problem of loading multiple SSL cerificates onto one web server (to serve multiple websites)
    • It's a newer protocol and requires the client to indicate the hostname of the target server in the initial SSL hadshake
    • The server will then find the correct certifcate, or return the default one
    • Only works for ALB & NLB, CloudFront
    • Doesn't work for CLB

    ELB - Connection Draining

    • Deregistration Delay for ALB & NLB
    • TIme to complete "in-fight requests" while the instnace is de-registering or unhealth 
    • Stops sending new request to the instance which is de-regsitering
    • Between 1 to 3600 seconds, default is 300 seconds
    • Can be disabled (set value to 0)
    • Set to a low value if your requests are short

    • Status checks cover only an EC2 instance's health, and not the health of your application, serer, or any Docker containers, running on the instnace.
    • If you application craches, the load balancer removes the unhealth instances from its target. However, your AutoScaling group doesn't automatically replace the unhealthy instnaces marked by the load balancer.
    • By Changing the health check typf from EC2 to ELB, you enabled the Auto Scaling group to automatically replae the unhealthy intnaces. The unhealthy instances are replaced when the health check fails.

    ASG doesn't create new AMI

    ASG doesn't add new volume.

    EC2 ASG groups are regional constructs. They can span AZs, but not AWS regions.

  • 相关阅读:
    Oracle:SQL语句--对表的操作——修改列的数据类型( 即 修改字段的数据类型)
    Oracle:SQL语句--对表的操作——修改列的数据类型( 即 修改字段的数据类型)
    有一分数序列:2/1,3/2,5/3,8/5,13/8,21/13...求出这个数列的前20项之和
    有一分数序列:2/1,3/2,5/3,8/5,13/8,21/13...求出这个数列的前20项之和
    鸡兔同笼:笼子里一共有鸡和兔子35只,一共有94条退, 笼子里一共有鸡和兔子共多少只
    jQuery,使用on代替delegate,live 写法区别
    安卓手机微信页面position: fixed位置错误
    表单提交是ajax提交,PC提交没问题但是手机提交就会一直跳到error,并且也没状态码一直是0
    新版本的jquery checkbox 全选反选代码只能执行一遍,第二次就失败attr与prop区别
    倒计时js代码
  • 原文地址:https://www.cnblogs.com/Answer1215/p/14868186.html
Copyright © 2011-2022 走看看