There is some kind of an issue with AWS CLI (cloudformation validate-template) which fails to validate a valid CloudFormation YAML stack:
$ aws cloudformation validate-template --template-body badges.template
An error occurred (ValidationError) when calling the ValidateTemplate operation: Template format error: unsupported structure.
Exited with: 255
At the same time you can successfully deploy that stack with deploy
:
$ aws cloudformation deploy --template-file badges.template --stack-name badges1 --capabilities CAPABILITY_IAM
Waiting for changeset to be created..
Waiting for stack create/update to complete
Successfully created/updated stack - badges1
I believe the validation logic is in the wrong here :) The offending template is in the Gist linked in the first line of this issue.
The difference here is between the parameters. --template-file
takes a file name while --template-body
expects the file contents. You would need to use file://
to load the file contents like so:
$ aws cloudformation validate-template --template-body file://badges.template
I feel so dumb :-/ . Thank you for pointing out my mistake!
Most helpful comment
The difference here is between the parameters.
--template-file
takes a file name while--template-body
expects the file contents. You would need to usefile://
to load the file contents like so: