如何通过Elasticbeanstalkconfiguration文件(使用Docker)访问环境variables?
例如,如果我希望装入由环境variables定义的特定卷。
我结束了使用下面的代码:
--- files: "/opt/elasticbeanstalk/hooks/appdeploy/pre/02my_setup.sh": owner: root group: root mode: "000755" content: | #!/bin/bash set -e . /opt/elasticbeanstalk/hooks/common.sh EB_CONFIG_APP_CURRENT=$(/opt/elasticbeanstalk/bin/get-config container -k app_deploy_dir) EB_SUPPORT_FILES_DIR=$(/opt/elasticbeanstalk/bin/get-config container -k support_files_dir) # load env vars eval $($EB_SUPPORT_FILES_DIR/generate_env | sed 's/$/;/')
如果您需要从Elastic Beanstalkconfiguration文件中访问环境variables,则可以执行以下操作:
commands: 01-vars: command: | $(/opt/elasticbeanstalk/containerfiles/support/generate_env | grep PARAM -v | sed 's/^/export/') && # do stuff
这假设你不需要默认的PARAM环境variables。
- Elastic Beanstalk / Docker – 没有这样的文件或目录package.json
- Ubuntu版本更新错误与Docker和ElasticBeanstalk
- Amazon Elastic Beanstalk vs使用docker容器的EC2实例
- 在AWS Elastic Beanstalk上使用Docker进行Django迁移
- AWS Docker部署
- 使用docker在AWS EC2上设置和缩放titan / cassandra
- AWS EB部署 – 我的应用程序在哪里?
- 使用AWS Application Load Balancer的Websocket超时
- docker错误 – “jq:错误:无法遍历空”