Rajas Paunikar
Rajas Paunikar

Reputation: 565

Please solve the error in AWS CLI {Parameter validation failed}

 aws cloudformation create-stack --stack-name ourfirsttest --region us-east-1 --template-body file://test.yml                

Upon running the above command I get this error below. I also have the 'test.yml' file in the current working directory

Parameter validation failed:
Invalid length for parameter TemplateBody, value: 0, valid range: 1-inf

Screenshot of the error

Screenshot of the error

Upvotes: 2

Views: 23756

Answers (2)

kenlukas
kenlukas

Reputation: 3973

Your template file is empty.

If it wasn't empty you'd get a different error message.

When I have an empty file I receive the same error you did:

Parameter validation failed:
Invalid length for parameter TemplateBody, value: 0, valid range: 1-inf

When I have a file with random characters in it the error message is:

An error occurred (ValidationError) when calling the ValidateTemplate operation: Template format error: At least one Resources member must be defined.

If the template-body file is missing you receive another type of error message:

Error parsing parameter '--template-body': Unable to load paramfile file://blahx.yml: [Errno 2] No such file or directory: 'blahx.yml'

Upvotes: 4

Arun Kamalanathan
Arun Kamalanathan

Reputation: 8593

It looks like your template file is malformed.

I would first validate the template using the CLI command.

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

Upvotes: 1

Related Questions