Search code examples
amazon-web-servicesamazon-elastic-beanstalkebcli

Create a single instance Elastic Beanstalk application with eb-cli


So i have a java application with the appropriate Procfile/Buildfile.

I have ran eb create in our scratch Elastic Beanstalk environment but i have to follow up with a manual configuration change to make it a single instance type vs a load balanced.

How would i use the eb-cli where upon eb create $ENVIRONMENT_NAME it generates a single instance environment?

There is a .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

Solution

  • I figured out. You have to create a file with the extension .config under in the directory .ebextensions of your project.

    {
      "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"
        },
      ]
    }