我在通过应用程序包的根目录下的.ebextensions/*.config文件定义实例types和安全组时遇到了问题。
简而言之,我有两个看起来像这样的configuration文件:
.ebextensions/01-options.config :
option_settings: [...] - namespace: 'aws:elasticbeanstalk:application:environment' option_name: CONFIG_FILE_ONE value: '01-options.config' [...]
和.ebextensions/02-app-test-env.config :
option_settings: - namespace: 'aws:elasticbeanstalk:application:environment' option_name: NODE_ENV value: 'Test' - namespace: 'aws:elasticbeanstalk:application:environment' option_name: CONFIG_FILE_TWO value: '02-app-test-env' - namespace: aws:autoscaling:launchconfiguration option_name: InstanceType value: t2.micro - namespace: aws:autoscaling:launchconfiguration option_name: SecurityGroups value: sg-ys75dfs2
现在,环境variables正在设置,所以我知道它正在读取两个configuration文件,但安全组和实例types没有被设置 – 即使在我重build环境时,实例仍然被创build为t1.micro默认安全组 – 我的设置没有被应用。
我在这里错过了什么? 我如何使用.config文件定义实例types?
您应该能够使用该configuration文件中用于启动configuration命名空间的内容,但是您需要围绕命名空间和值的单引号,就像前两个正在工作的引号一样。
- namespace: 'aws:autoscaling:launchconfiguration' option_name: InstanceType value: 't2.micro' - namespace: 'aws:autoscaling:launchconfiguration' option_name: SecurityGroups value: 'sg-ys75dfs2'
另外,如果使用eb cli 3.x,一定要注意eb日志的错误。 希望有所帮助。