amazon-web-services - AWS Beanstalk - 如果没有来自 CLI 的负载均衡器,则无法在 VPC 中创建环境

标签 amazon-web-services amazon-elastic-beanstalk

我想使用 AWS Elastic Beanstalk 创建一个简单的单实例环境。我可以从 AWS 控制台执行此操作,但当我尝试从 CLI 执行此操作时,它会为我创建一个负载均衡器 - 似乎无论我在 option_settings 中输入什么内容。

这是我放置在 .ebextensions 文件夹中的配置文件:

{
  "option_settings": [
    {
      "namespace": "aws:autoscaling:launchconfiguration",
      "option_name": "InstanceType",
      "value": "t2.micro"
    },
    {
      "namespace": "aws:elasticbeanstalk:environment",
      "option_name": "EnvironmentType",
      "value": "SingleInstance"
    },
    {
      "namespace": "aws:autoscaling:launchconfiguration",
      "option_name": "SecurityGroups",
      "value": "sg-XXXXXXX"
    },
    {
      "namespace": "aws:autoscaling:launchconfiguration",
      "option_name": "EC2KeyName",
      "value": "XXXXXXXX"
    },
    {
      "namespace": "aws:ec2:vpc",
      "option_name": "VPCId",
      "value": "vpc-XXXXXX"
    },
    {
      "namespace": "aws:ec2:vpc",
      "option_name": "Subnets",
      "value": "subnet-XXXXXXX"
    },
    {
      "namespace": "aws:autoscaling:asg",
      "option_name": "MinSize",
      "value": 1
    },
    {
      "namespace": "aws:autoscaling:asg",
      "option_name": "MaxSize",
      "value": 1
    }
  ],
  "packages": {
    "yum": {
      "postgresql94-devel": [],
      "git": []
    }
  }
}

我看到 EB 环境配置仪表板的“网络层”部分中列出了负载均衡器,并且我已验证它是在 AWS 控制台的 EC2 部分中创建的。

如何在没有负载均衡器的情况下从 CLI 启动 Beanstalk 环境?任何帮助将不胜感激。

最佳答案

您使用的是哪个 CLI aws clieb cli ?我猜是 eb cli。

除了您在 ebextensions 中指定的选项设置之外,至少 eb cli 和 AWS 管理控制台默认会在 API 参数中传递一些选项设置。在 Web 控制台中,您会看到一个下拉菜单,用于选择负载平衡或单实例环境。在 EB CLI 中,我认为您会收到选择负载均衡环境的提示。您还可以将 --single 选项传递给 eb create。如果您没有指定任何内容,它将假定默认值是负载平衡的。因此,即使您在 ebextension 中指定了选项设置,API 参数中也会传递一个选项设置。 Elastic Beanstalk 优先考虑使用 API 设置的值,而不是 ebextension 中的值。

this文档说:

The EB command line interface (CLI) and Elastic Beanstalk console provide recommended values for some configuration options. These values can be different from the default values and are set at the API level when your environment is created. Recommended values allow Elastic Beanstalk to improve the default environment configuration without making backwards incompatible changes to the API. For example, both the EB CLI and Elastic Beanstalk console set the configuration option for EC2 instance type (InstanceType in the aws:autoscaling:launchconfiguration namespace). Each client provides a different way of overriding the default setting. In the console you can choose a different instance type from a drop down menu on the Configuration Details page of the Create New Environment wizard. With the EB CLI, you can use the --instance_type parameter for eb create.

关于amazon-web-services - AWS Beanstalk - 如果没有来自 CLI 的负载均衡器,则无法在 VPC 中创建环境,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35066657/

相关文章:

amazon-web-services - Swarm 上的多主机 Docker 组合应用程序

amazon-elastic-beanstalk - AWS CDK : Get LoadBalancer ARN of ElasticBeanstalk Environment for ApiGateway VPC Link

ruby-on-rails - Elastic Beanstalk 上的 Rails,无法执行负载均衡器运行状况检查

amazon-web-services - 如何排查 Dockerrun 解析错误?

amazon-web-services - 使用 AWS CDK 解决 AWS Cloudformation 中的资源相互依赖性

amazon-web-services - Alexa是 'Unable to Reach the Requested Skill'

amazon-web-services - 在 AWS Glue 中读取 Parquet 文件

amazon-web-services - AWS CloudFormation 资源可以自行调用 !GetAtt 吗?

ruby-on-rails - AWS Elastic Beanstalk 和 Every Gem

python - 在哪里可以更改 Elastic Beanstalk 环境的 RDS_DB_NAME 设置