11

I'm having trouble defining instance type and security groups through .ebextensions/*.config files in the root of my application bundle.

Briefly, I have two config files that look like this:

.ebextensions/01-options.config:

option_settings:
  [...]
  - namespace: 'aws:elasticbeanstalk:application:environment'
    option_name: CONFIG_FILE_ONE
    value: '01-options.config'
  [...]

and .ebextensions/02-app-test-env.config:

option_settings:
  - namespace: 'aws:elasticbeanstalk:application:environment'
    option_name: NODE_ENV
    value: 'Test'

  - namespace: 'aws:elasticbeanstalk:application:environment'
    option_name: CONFIG_FILE_TWO
    value: '02-app-test-env'

  - namespace: aws:autoscaling:launchconfiguration
    option_name: InstanceType
    value: t2.micro

  - namespace: aws:autoscaling:launchconfiguration
    option_name: SecurityGroups
    value: sg-ys75dfs2

Now, the environment variables are being set, so I know it's reading both config files, but the security group and instance type aren't being set - even when I rebuild the environment, instances are still created as t1.micro with default security groups - my settings aren't being applied.

What am I missing here? How can I define the instance type using .config files?

1
  • Did you check the logs after the app is up and running? Maybe it complained on one of your options? After reading this I got the impression that only the namespaces listed in that table is supported, due to this sentence: [...] The following table displays the namespaces that are supported for each container type. [...]. But it seems strange if that would be the case.
    – Bazze
    Jan 13, 2015 at 18:47

2 Answers 2

11

You should be able to use what you have in that config file for the launchconfiguration namespace, but you need the single quotes around the namespace and value like you have in the first 2 that are working.

- namespace: 'aws:autoscaling:launchconfiguration'
  option_name: InstanceType
  value: 't2.micro'

- namespace: 'aws:autoscaling:launchconfiguration'
  option_name: SecurityGroups
  value: 'sg-ys75dfs2'

Also, be sure to watch for errors with eb logs if using eb cli 3.x. Hope that helps.

7
  • I tried this an it both the original and the version with quotes. Neither worked for me. Other settings in my .config such as MinSize and MaxSize are working. Ended up having to use: eb create -i 't2.medium' instead?!
    – Charles
    Oct 16, 2015 at 13:53
  • @Charles, yeah I'm no longer getting InstanceType to work either, not sure what the problem is there because as you mentioned, the other instance-related options work.
    – Tyler
    Oct 17, 2015 at 22:59
  • Thanks for the confirmation. Going to post the question in AWS forum ... will report back if I find out the answer.
    – Charles
    Oct 17, 2015 at 23:23
  • AWS forum question: forums.aws.amazon.com/thread.jspa?threadID=218096
    – Charles
    Oct 18, 2015 at 0:42
  • 1
    So I think I might be onto what the issue is here, looks like certain items are set at the API level and you have to update them AFTER environment creation. If you use the Elastic Beanstalk console or EB CLI to create environments, and you want to set these options using configuration files or saved configurations, you can remove the options settings with the AWS CLI or EB CLI after the environment is created. (docs.aws.amazon.com/elasticbeanstalk/latest/dg/…)
    – Tyler
    Oct 19, 2015 at 17:03
3

As mentioned in the comments, the settings in the config files are ignored if they are also set on the environment level, (and the setting for InstanceType is automatically created on the environment level).

If you prefer to keep your settings in the config files, you need to remove them from the environment, you can do that for InstanceType with the following command:

aws elasticbeanstalk update-environment --environment-name my-env --options-to-remove Namespace=aws:autoscaling:launchconfiguration,OptionName=InstanceType

See also the AWS docs for other ways to change environment level settings.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .