简体   繁体   中英

AWS Elastic Beanstalk environment variables do not update from config file

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM