"You can't enable rolling updates for a single-instance environment" 即使未指定 "aws:autoscaling:updatepolicy:rollingupdate"

"You can't enable rolling updates for a single-instance environment" even when not specifying "aws:autoscaling:updatepolicy:rollingupdate"

我正在尝试使用 EB CLI 创建新的 Elastic Beanstalk 环境,但由于选项无效而失败,即使我的配置中未设置该选项也是如此。

我的命令是运行:

$ eb create my-new-environment -v --timeout 15

我遇到的错误:

2020-09-27 08:45:00    ERROR   "option_settings" in one of the configuration files failed validation. More details to follow.
2020-09-27 08:45:00    ERROR   Invalid option value: '1.0' (Namespace: 'aws:autoscaling:updatepolicy:rollingupdate', OptionName: 'MinInstancesInService'): You can't enable rolling updates for a single-instance environment.
2020-09-27 08:45:01    ERROR   Failed to launch environment.

但是我的配置文件中没有指定 aws:autoscaling:updatepolicy:rollingupdate

# .ebextensions/settings.config

option_settings:
    aws:elasticbeanstalk:managedactions:
        ManagedActionsEnabled: true
        PreferredStartTime: "Thu:04:00"
    aws:elasticbeanstalk:managedactions:platformupdate:
        UpdateLevel: minor
        InstanceRefreshEnabled: true
    aws:elasticbeanstalk:command:
        DeploymentPolicy: AllAtOnce
    aws:elasticbeanstalk:environment:
        EnvironmentType: SingleInstance
    aws:ec2:instances:
        InstanceTypes: t3.medium
    aws:elasticbeanstalk:cloudwatch:logs:
        StreamLogs: true
        DeleteOnTerminate: true
        RetentionInDays: 1
    aws:elasticbeanstalk:application:
        Application Healthcheck URL: /health
    aws:autoscaling:launchconfiguration:
        MonitoringInterval: 1 minute

这是我的 .elasticbeanstalk/config.yml:

# .elasticbeanstalk/config.yml

deploy:
  artifact: out.zip
global:
  application_name: my-application
  branch: null
  default_ec2_keyname: null
  default_platform: 64bit Amazon Linux 2 v2.0.2 running .NET Core
  default_region: eu-west-1
  include_git_submodules: true
  instance_profile: null
  platform_name: null
  platform_version: null
  profile: null
  repository: null
  sc: git
  workspace_type: Application

如果有帮助,我认为我在之前的尝试中确实设置了 MinInstancesInService 选项,但我已经从我的配置中删除了它;我已经双重和三次检查了我的 out.zip 人工制品中只有我的配置的新版本。

根据评论。

问题是由于 EB CLI 忽略了配置文件中的某些设置。来自 docs:

Because the recommended values are set at the API level, they will override values for the same options that you set in configuration files or saved configurations.

解决方案 是使用 EB CLI 选项 --single.

将 EB 环境显式设置为 single-instance 类型
eb create my-new-environment -v --timeout 15 --single

通过 select EB 实例和 select 配置,然后 select 滚动更新,很容易从 AWS 控制台禁用“滚动更新”,并将其禁用。你可以。现在指定没有负载平衡的单个实例。

当部署实例主要用于测试目的或者您预计后端不会有太多流量时,我这样做是为了节省一些费用。

大卫