将.config文件传递给AWS Elastic Beanstalk

时间:2015-09-17 04:34:09

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

我正在使用Elastic Beanstalk命令行工具和函数eb config put config。根据AWS Elastic Beanstalk文档,您需要根据* .cfg.yml命名文件,并将其放在.elasticbeanstalk / saved_configs文件(http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/eb3-config.html#eb3-configexample)中。我这样做了,它迫使你写Yaml。我对Yaml了解不多,但我尝试了很多不同的编写配置文件的方式,我不能让EB接受它。以下基本上是我认为最接近的(注意实际名称和下面替换的网址):

  aws:
    elasticbeanstalk:
      create-configuration-template:
        application_name: ProjectName
        template_name: TemplateName
        environment_id: EnvironmentName
        - option_settings:
          option_name: mongodb
          value: "mongoAddress.com"

上述错误消息是:

ERROR: Error parsing configuration file as yaml or json.  Yaml error: 'Invalid Yaml: while parsing a block mapping
 in "<reader>", line 4, column 5:
        application_name: ProjectName
        ^
expected <block end>, but found BlockEntry
 in "<reader>", line 7, column 5:
        - option_settings:
        ^
', Json error: 'Invalid JSON: Unexpected character (a) at position 0.'

如果我在option_settings之前删除了“ - ”,那么我会收到此错误:

ERROR: Invalid Environment Configuration specification. Must specify configuration template version.

有什么想法吗?我在互联网上查了一下,但在这个

上找不到任何东西

编辑:以下是AWS文档模板的更多内容:http://docs.aws.amazon.com/cli/latest/reference/elasticbeanstalk/create-configuration-template.html

1 个答案:

答案 0 :(得分:4)

来自AWS的Abhishek Singh在Twitter上回复了我,并在AWS网站上分享了这篇博文。

https://blogs.aws.amazon.com/application-management/post/Tx1YHAJ5EELY54J/Using-the-Elastic-Beanstalk-EB-CLI-to-create-manage-and-share-environment-config

总之,他建议使用“eb config save”然后修改文件,这样你就不必担心格式了。有关如何执行此操作的详细信息,请参阅上面的帖子。