即使未指定“ 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

由于建议的值是在 API级别中设置的,因此它们将覆盖值,与您在配置文件或保存的配置中设置的相同。

解决方案是使用EB CLI选项--single将EB环境显式设置为单实例类型。

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