Template format error: unsupported structure seen in AWS CloudFormation

Amazon Web-ServicesAmazon Cloudformation

Amazon Web-Services Problem Overview


I am trying to validate an AWS example CloudFormation template using a command like:

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

This leads to the following error message:

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

I tried this on many templates, including example templates from the AWS documentation. So I know the templates are okay.

What am I doing wrong?

Amazon Web-Services Solutions


Solution 1 - Amazon Web-Services

Apparently, the very unhelpful error message comes as a result of improper formatting in the CLI command.

The --template-body argument must be specified as a file URI.

Thus, the correct, runnable form of the command above is:

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

See this blog post for more information.

Solution 2 - Amazon Web-Services

In case, you are using windows file system, you can use like this:

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

or

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

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionbgenchelView Question on Stackoverflow
Solution 1 - Amazon Web-ServicesbgenchelView Answer on Stackoverflow
Solution 2 - Amazon Web-ServicesjelongparkView Answer on Stackoverflow