在.ebextension中解析.config YAML文件时出现AWS错误

时间:2017-05-10 11:43:42

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

当部署到Elasticbeanstalk时,我的部署失败,并且由.ebextension文件夹中的.config文件引起的解析错误,但对我来说似乎没问题。任何人都可以告诉我如何解决它? .config文件如下所示:

files:
   "/opt/elasticbeanstalk/hooks/appdeploy/post/01_copy_htaccess_after_deployment.sh":
     mode: "000755",
     owner: root,
     group: root,
     content: |
       yes | /bin/cp /var/app/current/.htaccess.new /var/app/current/.htaccess

错误:

  

配置文件   .ebextensions / 08_htaccess_create_script_post_deploy.config in   应用版本   git-bce52a5381c7ac6735249419c48b1fe116168610-1494415808045包含   无效的YAML或JSON。 YAML异常:无效的Yaml:解析a时   块映射在"",第3行,第10列:模式:" 000755",^   预期,但在"",第3行找到FlowEntry,   第24列:模式:" 000755",^,JSON异常:无效的JSON:   位置0处的意外字符(f)。更新配置   文件。

1 个答案:

答案 0 :(得分:1)

根据aws dcumentation,您不需要在模式所有者和组后面使用coma。所以你的yml配置文件应如下所示:

files:
   "/opt/elasticbeanstalk/hooks/appdeploy/post/01_copy_htaccess_after_deployment.sh":
     mode: "000755"
     owner: root
     group: root
     content: |
       yes | /bin/cp /var/app/current/.htaccess.new /var/app/current/.htaccess

以下是语法

的示例
files:  
  "target file location on disk": 
     mode: "six-digit octal value"
     owner: name of owning user for file
     group: name of owning group for file
     source: URL
     authentication: authentication name:

  "target file location on disk": 
     mode: "six-digit octal value"
     owner: name of owning user for file
     group: name of owning group for file
     content: |
    this is my content
     encoding: encoding format
     authentication: authentication name: