使用 eb-cli 创建单实例 Elastic Beanstalk 应用程序

Create a single instance Elastic Beanstalk application with eb-cli

所以我有一个 java 应用程序,其中包含适当的 Procfile/Buildfile。

我在我们的临时 Elastic Beanstalk 环境中创建了 运行 eb,但我必须跟进手动配置更改以使其成为单一实例类型与负载平衡。

我如何使用 eb-cli 在 eb create $ENVIRONMENT_NAME 它生成单实例环境的地方?

有一个.elasticbeanstalk/config.yml

branch-defaults:
  development:
    environment: development
    group_suffix: null
  staging:
    environment: staging
    group_suffix: null
  production:
    environment: production
    group_suffix: null
global:
  application_name: feed-engine
  branch: null
  default_ec2_keyname: null
  default_platform: Java 8
  default_region: us-east-1
  profile: prod
  repository: null
  sc: git

我想通了。您必须在项目的 .ebextensions 目录下创建一个扩展名为 .config 的文件。

{
  "option_settings" : [
    {
      "namespace" : "aws:elasticbeanstalk:application",
      "option_name" : "Application Healthcheck URL",
      "value" : "/"
    },
    {
      "namespace" : "aws:autoscaling:asg",
      "option_name" : "MinSize",
      "value" : "1"
    },
    {
      "namespace" : "aws:autoscaling:asg",
      "option_name" : "MaxSize",
      "value" : "1"
    },
    {
      "namespace" : "aws:autoscaling:asg",
      "option_name" : "Custom Availability Zones",
      "value" : "us-east-1a"
    },
    {
      "namespace" : "aws:elasticbeanstalk:environment",
      "option_name" : "EnvironmentType",
      "value" : "SingleInstance"
    },
  ]
}