【问题标题】:Template format error: unsupported structure seen in AWS CloudFormation模板格式错误:AWS CloudFormation 中出现不支持的结构
【发布时间】:2017-06-18 22:55:10
【问题描述】:

我正在尝试使用以下命令验证 AWS 示例 CloudFormation 模板:

▶ aws cloudformation validate-template --template-body template.yml

这会导致以下错误消息:

An error occurred (ValidationError) when calling the ValidateTemplate operation:
  Template format error: unsupported structure. 

我在许多模板上都试过这个,包括 AWS 文档中的示例模板。所以我知道模板没问题。

我做错了什么?

【问题讨论】:

  • 致亲密的选民......这个问题显然不是SO的话题。 AWS CloudFormation 是开发人员用来在云中部署应用程序的工具;例如亚马逊上的无服务器应用程序; AWS CFN 是一种具有编程特性的声明式 DSL;没有编程知识的 SF 人无法回答这个问题,也没有任何用处。

标签: amazon-web-services amazon-cloudformation


【解决方案1】:

显然,非常无用的错误消息是由于 CLI 命令中的格式不正确造成的。

--template-body 参数必须指定为file URI

因此,上述命令的正确、可运行形式是:

▶ aws cloudformation validate-template --template-body file://template.yml

有关详细信息,请参阅 this 博客文章。

【讨论】:

  • 字符串“hellobucket.yml”不是正确的cloudformation模板的错误sys ;)
  • 我的测试表明,只要包含file://,文件的相对路径就可以从命令行工作
  • 对未来读者的一点澄清...--template-body CLI 参数采用string 参数,即模板作为字符串。使用file:// 允许提供本地文件而不是字符串。
  • 如果假定这是一个 uri,那么最好在错误消息中显示假定的模式,这样如果我看到“http://template.yml”我知道我需要修改http: by file:
  • 如果没有这个答案,我将无法解决这个问题!你在避风港有一个特殊的地方......
【解决方案2】:

如果你使用的是windows文件系统,你可以这样使用:

--template-body file://c:/Windows/myfile.json

--template-body file://localhost/c$/Windows/myfile.json

【讨论】:

    猜你喜欢
    • 2019-08-15
    • 2017-12-30
    • 2020-12-19
    • 1970-01-01
    • 2014-11-10
    • 2019-04-26
    • 2023-03-07
    • 1970-01-01
    • 2019-06-06
    相关资源
    最近更新 更多