是否可以从 .ebextensions 配置文件中引用 PARAM1/PARAM2 等容器环境属性。如果是这样,如何?我试过 $PARAM1 但它似乎是一个空值。
我想在启动时设置主机名以包含 DEV、QA 或 PROD,我通过 PARAM1 环境变量将其传递给我的容器。
commands:
01-set-correct-hostname:
command: hostname myappname{$PARAM1}.com
最佳答案
事实证明,您只能在 container_commands
中执行此操作部分,而不是 commands
部分。
这有效:
container_commands:
01-set-correct-hostname:
command: "hostname myappname{$PARAM1}.com"
见 http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/customize-containers-ec2.html#customize-containers-format-container_commands更多细节。
关于amazon-web-services - 从 Elastic Beanstalk .ebextensions 配置文件中引用环境变量,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16585898/