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?
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.
Also, be sure to watch for errors with eb logs if using eb cli 3.x. Hope that helps.
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:See also the AWS docs for other ways to change environment level settings.