【问题标题】:AWS Elasticbeanstalk CLI ignores instace type optionAWS Elastic Beanstalk CLI 忽略实例类型选项
【发布时间】:2020-06-26 11:07:03
【问题描述】:

我有一个使用 Flask 的 python 应用程序,我正在尝试使用 EB CLI 将其部署到 Elasticbeanstalk。 我正在遵循此处提到的部署步骤:

https://docs.amazonaws.cn/en_us/elasticbeanstalk/latest/dg/create-deploy-python-flask.html#python-flask-deploy

我运行了以下命令

eb init -p python-3.6 demo-v1 --region us-west-2
eb init
eb create demo-env -it t3a.large

我收到以下错误

ERROR: ServiceError - Create environment operation is complete, but with errors. For more information, see troubleshooting documentation.

我检查了 eb-activity.log,发现有一个MemoryError,这是因为没有足够的空间来安装所有的包(在 requirements.txt 中指定)。

然后我检查了实例类型,它显示实例类型为 t2.micro。 我不得不手动进入 ELB 控制台配置 -> 容量 -> 将实例类型从 t2.micro 更改为 t3a.large

似乎 CLI 忽略了实例类型标志,并且没有引发错误或警告。 如何为我的应用程序指定实例类型?

【问题讨论】:

    标签: amazon-web-services amazon-ec2 amazon-elastic-beanstalk ebcli


    【解决方案1】:

    我相信您想要使用的选项是 -i 或 --instance-type。 -it 选项用于实例类型,它需要一个实例类型列表,而不仅仅是一个。最有可能发生的事情是,当 ebcli 期望像 eb create demov2 -it "t2.micro, t3.micro, t3a.large" 之类的东西时,它不知道如何只使用一种实例类型。

    【讨论】:

    【解决方案2】:

    我发布了一个“解决方法”,因为这个问题仍然存在。

    我创建了一个名为01instance_setting.config 的文件。我将此添加到我的.ebextensions 文件夹中。这是01instance_setting.config的内容

    option_settings:
      aws:autoscaling:asg:
        MinSize: 1
        MaxSize: 3
      aws:autoscaling:launchconfiguration:
        RootVolumeType: gp2
        RootVolumeSize: "32"
        EC2KeyName: my-key-pair
        MonitoringInterval: "2 minute"
      aws:ec2:instances:
        InstanceTypes: t3a.large
    

    我认为这是一种更好的方法,而不是在从 CLI 创建环境时指定实例。如果您要创建多个环境,它会更加灵活。

    【讨论】:

      猜你喜欢
      • 2015-12-21
      • 2016-05-10
      • 1970-01-01
      • 2021-12-12
      • 2017-11-18
      • 2016-05-12
      • 1970-01-01
      • 1970-01-01
      • 2020-09-02
      相关资源
      最近更新 更多