amazon-web-services - 从 Elastic Beanstalk .ebextensions 配置文件中引用环境变量

标签 amazon-web-services amazon-elastic-beanstalk

是否可以从 .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/

相关文章:

swift - 列出 AWS S3 存储桶中的所有对象

amazon-web-services - 在aws管理控制台中哪里可以修改elastic beanstalk健康检查url?

python - 弹性 beantalk 需要 python 3.5

amazon-web-services - 如何构建一个只有一个 EC2 实例的 CloudFormation 和 Elastic Beanstalk 解决方案?

amazon-web-services - 在 AWS ACM 中导入证书的正确方法是什么?

amazon-web-services - AWS RDS 和 pgAdmin4 : Unable to connect to server: could not connect to server: Connection timed out

amazon-web-services - Elastic Beanstalk、不可变部署和 CloudFormation 的问题

nginx - 带有Nginx的ElasticBeanstalk MultiContainer docker

amazon-web-services - CloudFormation EC2 Windows 管理员密码

amazon-web-services - 如何在fargate中连接两个任务