When updating my env var values from an .ebextensions/env-var.config file, the env var is not updated within my environment. If I add a new env var to the config file it gets added to the environment as expected.
Original env-var.config file
option_settings:
aws:elasticbeanstalk:application:environment:
VAR1=foo
VAR2=bar
Running eb printenv will return me foo and bar for these two env vars. If I update the config file:
option_settings:
aws:elasticbeanstalk:application:environment:
VAR1=test
VAR2=bar
VAR3=new
Running eb printenv will return me:
VAR1 = foo
VAR2 = bar
VAR3 = new
How can I update environment variables from the config file?
Any already set environment variables will retain their values. If you want to change their values, you can either go to console and change it there under software configuration or you can issue eb setenv key=value CLI command to force the update.
Note that it is not the best practice to set environment variables via .config file. The reason is that environment variables are often of sensitive nature (credentials) and you may accidentally push this file to your code repository.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With