我们正在尝试在s3中存储环境特定的应用程序配置文件。 这些文件存储在以环境命名的不同子目录中,并且还将环境作为文件名的一部分。AWS Elastic Beanstalk:如何在ebextensions中使用环境变量?
实例是
dev/application-dev.properties
stg/application-stg.properties
prd/application-prd.properties
弹性豆茎环境被命名为dev的,STG,PRD以及或者我也有在弹性豆茎名为环境中定义的环境变量可以是dev的,STG或PRD 。
我现在的问题是,如何从在.ebextensions配置文件下载配置文件时引用环境名称或环境变量?
我试图部署在使用中.ebextensions/myapp.config一个{"Ref": "AWSEBEnvironmentName" }
参考,但出现语法错误。
.ebextensions的内容/ myapp.config是:
files:
/config/application-`{"Ref": "AWSEBEnvironmentName" }`.properties:
mode: "000666"
owner: webapp
group: webapp
source: https://s3.amazonaws.com/com.mycompany.mybucket/`{"Ref": "AWSEBEnvironmentName" }`/application-`{"Ref": "AWSEBEnvironmentName" }`.properties
authentication: S3Access
Resources:
AWSEBAutoScalingGroup:
Metadata:
AWS::CloudFormation::Authentication:
S3Access:
type: S3
roleName: aws-elasticbeanstalk-ec2-role
buckets: com.mycompany.api.config
我得到的错误是:
The configuration file .ebextensions/myapp.config in application version
manualtest-18 contains invalid YAML or JSON. YAML exception: Invalid Yaml:
mapping values are not allowed here in "<reader>", line 6, column 85:
... .config/stg/application-`{"Ref": "AWSEBEnvironmentName" }`.prop ...^,
JSON exception: Invalid JSON: Unexpected character (f) at position 0..
Update the configuration file.
什么是引用在.ebextensions配置环境变量的正确方法AWS Elastic Beanstalk中的文件?