Env Variable in .ebextensions “files:” section

旧巷老猫 提交于 2019-12-03 02:41:15

Use Fn::GetOptionSetting to retreive environment variables. Environment variables are in aws:elasticbeanstalk:application:environment namespace

files:
  "/tmp/application.properties" :
    mode: "000644"
    owner: root
    group: root
    source: '`{"Fn::GetOptionSetting": {"Namespace": "aws:elasticbeanstalk:application:environment", "OptionName": "MY_ENVIRONMENT_VARIABLE", "DefaultValue": "file_path"}}`'
    authentication: S3Auth

Note the backtick which perform the command substitution. DefaultValue attribute is optional, which is used in case environment variable is not found.

Above config file will create file /tmp/application.properties with content from the file referenced in environment variable MY_ENVIRONMENT_VARIABLE.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!