I have the following very simple CloudFormation template:
---
AWSTemplateFormatVersion: 2010-09-09
Parameters:
InstanceType:
Description: 'EC2 Instance Type'
Default: t2.micro
Resources:
EC2Instance:
Type: 'AWS::EC2::Instance'
Properties:
ImageId: ami-08589eca6dcc9b39c
InstanceType: !Ref InstanceType
KeyName: default
On validating this template using:
▶ aws cloudformation validate-template --template-body file://cloudformation.yml
I receive the following cryptic error message:
An error occurred (ValidationError) when calling the ValidateTemplate operation:
Template format error: Every Parameters object must contain a Type member.
What does it mean? I googled for this error message and found nothing.
The error message can be confusing - especially if you have a lot of parameters - and it does not appear to be documented anywhere. It is however mentioned here in the docs that:
Each parameter must be assigned a parameter type that is supported by AWS CloudFormation. For more information, see Type.
Thus to fix this template, just add a type:
---
AWSTemplateFormatVersion: 2010-09-09
Parameters:
InstanceType:
Type: String ## ADD THIS LINE
Description: 'EC2 Instance Type'
Default: t2.micro
Resources:
EC2Instance:
Type: 'AWS::EC2::Instance'
Properties:
ImageId: ami-08589eca6dcc9b39c
InstanceType: !Ref InstanceType
KeyName: default
See also related questions here at Stack Overflow.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With