Amazon web services 模板格式错误:在AWS CloudFormation中看到不受支持的结构

Amazon web services 模板格式错误:在AWS CloudFormation中看到不受支持的结构,amazon-web-services,amazon-cloudformation,Amazon Web Services,Amazon Cloudformation,我尝试使用以下命令验证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示例CloudFormation模板:

▶ aws cloudformation validate-template --template-body template.yml
这将导致以下错误消息:

An error occurred (ValidationError) when calling the ValidateTemplate operation:
  Template format error: unsupported structure. 
我在许多模板上尝试了这一点,包括AWS文档中的示例模板。所以我知道模板是好的


我做错了什么?

显然,非常没有帮助的错误消息是由于CLI命令中的格式不正确造成的

--template body
参数必须指定为

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

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

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

如果您使用的是windows文件系统,您可以使用以下方式:

--模板正文文件:://c:/Windows/myfile.json


--模板体file://localhost/c$/Windows/myfile.json

错误提示字符串“hellobucket.yml”不是正确的cloudformation模板,这是真的;)我的测试表明,文件的相对路径可以从命令行运行,只要包含
file://
,为将来的读者做一点澄清。。。
--template body
CLI参数采用
string
参数,即模板作为字符串。使用
文件://
可以提供一个本地文件,而不是字符串。如果假定这是一个uri,那么最好在错误消息中显示假定的架构,这样,如果我看到“http://template.yml”,我知道我需要更改http:by文件:如果没有这个答案,我将无法解决这个问题!你在黑文有一个特殊的位置…对亲密的选民来说。。。很明显,这个问题并没有偏离主题。AWS CloudFormation是开发者用于在云中部署应用程序的工具;e、 g.亚马逊上的无服务器应用程序;AWS CFN是一种具有编程功能的声明性DSL;没有编程知识的SF人员无法回答这个问题,也没有任何用处。