【问题标题】:Will AWS Autoscaling group with MixedInstancesPolicy launch On-Demand instance if no spot instances available?如果没有可用的现场实例,具有 MixedInstancesPolicy 的 AWS Autoscaling 组会启动按需实例吗?
【发布时间】:2020-06-05 16:42:46
【问题描述】:

我正在使用具有混合策略的 AutoscalingGroup,其中 OnDemandBaseCapacity 和 OnDemandPercentageAboveBaseCapacity 为 0,因此它不会启动任何 On-Demand 实例,但总是在需要时尝试请求和启动 Spot 实例。 我的自动缩放组 Cloudformation 规范:

  AutoScalingGroupForApiServers:
    Type: AWS::AutoScaling::AutoScalingGroup
    Properties:
      VPCZoneIdentifier: !Ref VpcSubnetsForApiLoadBalancer
      MinSize: !Ref ASGMinSizeForApiServers
      MaxSize: !Ref ASGMaxSizeForApiServers
      HealthCheckType: !Ref HealthCheckTypeForApiServers
      HealthCheckGracePeriod: !FindInMap [ Constants, '-', AutoScalingGroupDefaultHealthCheckGracePeriod ]
      MixedInstancesPolicy:
        InstancesDistribution:
          OnDemandBaseCapacity: 0
          OnDemandPercentageAboveBaseCapacity: 0
          SpotAllocationStrategy: lowest-price
          SpotInstancePools: 2
        LaunchTemplate:
          LaunchTemplateSpecification:
            LaunchTemplateId: !Ref AutoScalingLaunchTemplateForApiServers
            Version: !GetAtt AutoScalingLaunchTemplateForApiServers.LatestVersionNumber
      LoadBalancerNames:
        - !Ref ElasticLoadBalancerForApiServers

我有两个问题:
1) 如果一个 Spot 实例终止并且没有另一个 Spot 实例可用,它是否会启动 On-Demand 实例然后将其缩减为 0?
2) 在收到 2 分钟的终止通知后,它会自动从引用的负载均衡器/目标组中抛出实例,还是我已经使用 CloudWatch/SNS/Lambda 手动处理它?

【问题讨论】:

    标签: amazon-web-services amazon-ec2


    【解决方案1】:

    1) If one spot instance terminates and there's no another spot instance available, will it launch On-Demand instance and then scale down it to 0? 它将尝试保持您在配置中提到的 OnDemand:Spot 比率。例如,如果您设置了 30% OnDemand 和 70% Spot。然后它将自动缩放组实例保持为 30% OnDemand 和 70% Spot。如果 Spot 实例不可用,则它不会启动 OnDemand 实例来补偿它。 2) Upon receiving 2-minute termination notice will it automatically throw out instance from referenced load balancers/target groups or do I have manually handle it with CloudWatch/SNS/Lambda? 如果您已将 AutoScaling 组与 Targetgroup 链接,那么它将自动从 TargetGroups 中删除已终止或不可用的实例。

    【讨论】:

      猜你喜欢
      • 2019-02-11
      • 2013-03-16
      • 2019-07-02
      • 1970-01-01
      • 2020-10-26
      • 2018-01-17
      • 1970-01-01
      • 2017-09-22
      • 2020-01-25
      相关资源
      最近更新 更多