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

Upon initial environment create using eb create the ebextensions are not reflected


Below is the setup of the application which runs a docker container into elasticbeanstalk.

enter image description here

step 1:

created the parent folder say apptest and inside that I have placed the Dockerfile, package.json and small hello world server.js node app.

step 2:

inside the parent folder apptest ran the command eb init which crated a hidden folder .elasticbeanstalk with config.yml comprising default settings.

step 3:

added .ebextensions with a config file 01_run.config, comprising the below configuration to update the instance type.

option_settings:
    aws:autoscaling:launchconfiguration :
        InstanceType : "m4.xlarge"

Note that till now no environment is created yet. And since I have extensions created, should override the defaults with the instance type pointed to m4.xlarge.

step 4:

Now ran the command eb create apptest-dev ( say for example ) and created the environment


Problem:

when the environment is created, it did not have the m4.xlarge, rather got created with default instance type as t2.micro. But when uploaded the zipped version of this folder contents into the environment from console ( excluding the .elasticbeanstalk folder ), ebextensions folder configuration is picked up. Its only with the option_settings not getting worked, but the other resources like files, commands are getting reflected both from command line and from the file upload.

I feel its kind of very small thing missing which I am not able to figure it out from blogs and documentation. Thanks for the help in advance.


Solution

  • During eb create, the EBCLI passes it's own defaults for many of the option settings, among which is the instance type. Since, the EBCLI does not parse .ebextensions, and the Beanstalk service prefers the defaults passed by the EBCLI, the instance type specified in your .ebextensions are disregarded.

    There are two ways to get around this:

    1. call eb config after eb create. In the interactive mode, change the instance type, and save and exit.
    2. call eb create as eb create -i m4.xlarge