Aws-cli: A CloudFormation stack that can be deployed, but not validated

Created on 5 Apr 2018  路  2Comments  路  Source: aws/aws-cli

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.

closing-soon

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 use file:// to load the file contents like so:

$ aws cloudformation validate-template --template-body file://badges.template

All 2 comments

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!

Was this page helpful?
0 / 5 - 0 ratings