【问题标题】:Auto Scaling Group with another instance type is not working on AWS具有其他实例类型的 Auto Scaling 组无法在 AWS 上运行
【发布时间】:2019-09-23 19:21:44
【问题描述】:

我正在关注 Auto Scaling Groups with Multiple Instance Types and Purchase Options - Amazon EC2 Auto Scaling 创建一个具有不同 ec2 类型(队列)的自动缩放组,但得到一个错误回报。

这在region=eu-west-1 中还没有激活吗?

即使使用文章中的相同示例,返回相同:

/usr/local/aws/bin/aws autoscaling create-auto-scaling-group --auto-scaling-group-name tmp-eli --cli-input-json 

'{"AutoScalingGroupName":"tmp-eli","MixedInstancesPolicy":{"LaunchTemplate":{
    "LaunchTemplateSpecification":{"LaunchTemplateName":"lt-10349","Version":"v1"},"
    Overrides":[{"InstanceType":"c4.2xlarge"},{"InstanceType":"c5.2xlarge"},{"InstanceType":"c5d.2xlarge"}]},"InstancesDistribution":{"OnDemandBaseCapacity":0,"OnDemandPercentageAboveBaseCapacity":50,"SpotInstancePools":2}},"MinSize":2,"MaxSize":100,"DesiredCapacity":4,"VPCZoneIdentifier":"subnet-ae6a6ed8,subnet-aa2c6ef2,s
    ubnet-07c8ce63","Tags":[]}' --output json

错误:

参数验证失败:

输入中的未知参数:“MixedInstancesPolicy”,必须是以下之一:AutoScalingGroupName、LaunchConfigurationName、LaunchTemplate、InstanceId、MinSize、MaxSize、DesiredCapacity、DefaultCooldown、AvailabilityZones、LoadBalancerNames、TargetGroupARNs、HealthCheckType、HealthCheckGracePeriod、PlacementGroup、VPCZoneIdentifier、TerminationPolicies、NewInstancesProtectedFromScaleIn , LifecycleHookSpecificationList, 标签

有什么想法吗?

【问题讨论】:

  • 您是否使用 UI 创建了启动配置?
  • 不,使用 cli

标签: amazon-web-services aws-cli fleet


【解决方案1】:

我们必须首先创建一个启动配置,步骤如下:

第 1 步:创建启动模板

第 2 步:创建 Auto Scaling 组

第 3 步:验证您的 Auto Scaling 组

第 4 步:(可选)删除您的扩展基础架构

在创建 Auto Scaling 组之前,启动配置应该已经存在。

AWS Auto Scaling

【讨论】:

  • 嗨,我需要通过 cli 自动完成,我还需要对不同类型的服务器进行特殊配置。我的旧系统只使用一种类型的服务器,长时间使用点服务器,有时我使用的类型不可用,所以我正在尝试构建配置以包含一种以上类型的 ec2 服务器 + 仅使用点服务器。谢谢你,伊莱
【解决方案2】:

我得到了同样的错误,但是当我清理了格式(如下所示)时,错误变为:

调用 CreateAutoScalingGroup 操作时发生错误 (ValidationError):启动模板版本无效:允许使用“$Default”、“$Latest”或数字版本。

所以,我把Version改成了1,然后报错:

调用 CreateAutoScalingGroup 操作时发生错误 (ValidationError):指定的启动模板,模板名称为 my-template-for-auto-scaling,不存在。

这是我运行的清理后的版本:

aws autoscaling create-auto-scaling-group --auto-scaling-group-name tmp-eli --cli-input-json '
{
    "AutoScalingGroupName": "tmp-eli",
    "MixedInstancesPolicy": {
        "LaunchTemplate": {
            "LaunchTemplateSpecification": {
                "LaunchTemplateName": "lt-10349",
                "Version": "1"
            },
            "Overrides": [
                {
                    "InstanceType": "c4.2xlarge"
                },
                {
                    "InstanceType": "c5.2xlarge"
                },
                {
                    "InstanceType": "c5d.2xlarge"
                }
            ]
        },
        "InstancesDistribution": {
            "OnDemandBaseCapacity": 0,
            "OnDemandPercentageAboveBaseCapacity": 50,
            "SpotInstancePools": 2
        }
    },
    "MinSize": 2,
    "MaxSize": 100,
    "DesiredCapacity": 4,
    "VPCZoneIdentifier": "subnet-ae6a6ed8,subnet-aa2c6ef2,subnet-07c8ce63",
    "Tags": []
}
' --output json

【讨论】:

  • 啊!刚刚意识到原因可能是由于运行/usr/local/aws/bin/aws(对我来说是aws-cli/1.16.26 Python/2.7.15)而不是简单的aws(这是aws-cli/1.16.114 Python/3.7.2)。所以,在没有完整路径的情况下尝试一下,看看它是否更适合你。
  • 尝试您的版本返回相同的错误:参数验证失败:输入中的未知参数:“MixedInstancesPolicy”,必须是以下之一:AutoScalingGroupName、LaunchConfigurationName、LaunchTemplate、InstanceId、MinSize、MaxSize、DesiredCapacity、DefaultCooldown、 AvailabilityZones, LoadBalancerNames, TargetGroupARNs, HealthCheckType, HealthCheckGracePeriod, PlacementGroup, VPCZoneIdentifier, TerminationPolicies, NewInstancesProtectedFromScaleIn, LifecycleHookSpecificationList, Tags
  • 你运行的是什么版本?使用:aws --version
  • [root@ip-172-31-19-187 eli]# aws --version aws-cli/1.14.28 Python/2.7.5 Linux/3.10.0-862.6.3.el7 .x86_64 botocore/1.8.35 [root@ip-172-31-19-187 eli]#
  • 尝试更新版本,同样的错误:eli@eli-laptop:~$ eli@eli-laptop:~$ sh test 参数验证失败:输入中的未知参数:“MixedInstancesPolicy”,必须为一个来自:AutoScalingGroupName、LaunchConfigurationName、LaunchTemplate、InstanceId、...eli@eli-laptop:~$ aws --version aws-cli/1.16.26 Python/3.6.8 Linux/4.18.0-17-generic botocore/1.12。 16
猜你喜欢
  • 2015-08-16
  • 2018-09-22
  • 2019-02-04
  • 2020-02-04
  • 1970-01-01
  • 2017-07-05
  • 2016-10-29
  • 2018-04-22
  • 2020-09-15
相关资源
最近更新 更多