9

I am trying to create cloudformation template to use but I keep getting the above error. Here is snippet from my template:

"Mappings" : {
    "AWSInstanceType2Arch" : {
            "t1.micro" : { "Arch" : "64" },
            "m1.small" : { "Arch" : "64" },
            "m1.medium" : { "Arch" : "64" },
            "m1.large" : { "Arch" : "64" },
            "m1.xlarge" : { "Arch" : "64" },
            "m2.xlarge" : { "Arch" : "64" },
            "m2.2xlarge" : { "Arch" : "64" },
            "m2.4xlarge" : { "Arch" : "64" },
            "m3.xlarge" : { "Arch" : "64" },
            "m3.2xlarge" : { "Arch" : "64" },
            "c1.medium" : { "Arch" : "64" },
            "c1.xlarge" : { "Arch" : "64" },
            "cc1.4xlarge" : { "Arch" : "64HVM" },
            "cc2.8xlarge" : { "Arch" : "64HVM" },
            "cg1.4xlarge" : { "Arch" : "64HVM" }
        },
    "AWSRegionArch2AMI" : {
                "us-west-2": {"AMI": "ami-1b3b462b"}
         }
     },

  "Resources": {
    "Ec2Instance" : {
          "Type" : "AWS::EC2::Instance",
    "Properties": {
        "ImageId": { "Fn::FindInMap": [ "AWSRegionArch2AMI", { "Ref": "AWS::Region" },
        { "Fn::FindInMap": [ "AWSInstanceType2Arch", {"Ref": "InstanceType"}, "Arch" ] } ] },
            "InstanceType": {"Ref": "InstanceType"},
            "SecurityGroups": [ { "Ref": "SecurityGroups"} ],
            "KeyName": { "Ref": "KeyName" },
            "Tags": [ { "Key": "Name", "Value": { "Ref": "InstanceName" } } ] }
    },

I have more happening on the bottom such as a bash script to be executed except I can't get passed this single issue. What am I missing?

2
  • Did you find a solution? Can you post the entire snippet with the complete error? Commented Dec 16, 2014 at 7:17
  • it was a spacing issue I believe. I am no longer experiencing the issue. Commented Dec 22, 2014 at 16:36

11 Answers 11

16

I came across this issue while looking for a solution to the same error message.

In my case I was getting the error:

Invalid template parameter property 'Properties'

This was because I had placed a resource definition in the "Parameters": { } section of the template instead of in the "Resources": { } section.

The error message is like that because Resources have a "Properties" section, but "Properties" are not valid for Parameters.

Sign up to request clarification or add additional context in comments.

Comments

5

I had the same error message when I tried adding Outputs to my template.

$ aws cloudformation validate-template --template-body "$(cat aws/vpc/production.template)"

A client error (ValidationError) occurred when calling the ValidateTemplate operation: Invalid template resource property 'InfrastructureIP'

My problem was that I had added the output under "Resources" instead of after.

INCORRECT

{
 "AWSTemplateFormatVersion" : "2010-09-09",

  "Parameters" : {
    #Some parameters
  },

  "Resources" : {
    #Whole lot of resources
    "Outputs" : {
      "InfrastructureIP" : {
        "Description": "The private IP of Infrastructure",  
        "Value" : { "Fn::GetAtt" : [ "Infrastructure", "PrivateIp" ] }
      }
    }
  }
}

CORRECT

{
 "AWSTemplateFormatVersion" : "2010-09-09",

  "Parameters" : {
    #Some parameters
  },

  "Resources" : {
    #Whole lot of resources
  },

  "Outputs" : {
    "InfrastructureIP" : {
      "Description": "The private IP of Infrastructure",  
      "Value" : { "Fn::GetAtt" : [ "Infrastructure", "PrivateIp" ] }
    }
  }
}

1 Comment

Stupid me had incomplete Parameters json object.
1

I had a variable name that was like security groups I got rid of this error by doing securityGroups

Check your json keys for correct naming conventions

Comments

0

Was a spacing issue. Fixed. Templates can be tricky.

3 Comments

Can you be more specific?
It's been a while so I don't remember the exact spacing issue.
I got a similair one when i had a comma instead of a colon
0

In my case, I was referring the output in the template file as [Output], instead of [Outputs], causing this issue.

Comments

0

I came across this issue, while finding solution for the problem -

The error was Invalid template property or properties

In my case, It was spacing problem. So in my case we were using jinja to generate templates and one template method (which was generating output) doesn't have proper indention or space. Finally fixed it after figuring issue after hours.

Comments

0

check if there is any space missing or any property with wrong name (remember properties are case sensitive). so 'Properties' is right one but 'properties' is not. 'KeyType' is right but 'keyType' is not.

So, Issues could be in spacing or naming convention not followed

Comments

0

I had a similar and as I am new to Cloud Formation I missed looking into the details of the CLI being invoked from my Jenkins shell scripts. And I will be honest that I didn't finish my reading of cloud formation and I jumped started on provisioning resources with it so I would recommend below steps

  1. Review the way you are invoking the cloud formation, look for indentation or syntactical errors. Best option is to use a text editor that can help rule out any silly mistakes as I did, I used Visual Studio Code to edit the files.
  2. Review the Stack.yml file and make sure that items are declared in their right spaces, in my case the Stack was accidentally moved inside the parent Parameters declaration because of white space issues

Here is my sample stack.yml and how I invoked cloud formation from Jenkins

AWSTemplateFormatVersion: "2010-09-09"
Parameters:
  ApplicationName:
    Type: String
  TemplateURL:
    Type: String
  TargetGroupArn:
    Type: AWS::SSM::Parameter::Value<String>
  EnvironmentFile:
    Type: String
  Image:
    Type: String
Resources:
  Stack:
    Type: AWS::CloudFormation::Stack
    Properties:
      TemplateURL: !Ref TemplateURL
      Parameters:
        ApplicationName: !Ref ApplicationName
        Image: !Ref Image
        Cpu: 1024
        Memory: 2048
        DesiredCount: 1
        Port: 8001
        TargetGroupArn: !Ref TargetGroupArn
        EnvironmentFile: !Ref EnvironmentFile

The invocation part was done in a shell script that was invoked within my Jenkins pipeline Below is a sample command to execute cloud formation.

# Deploy the stack
aws cloudformation deploy \
    --stack-name "$appName-$env" \
    --parameter-overrides \
        "ApplicationName=$appName" \
        "TemplateURL=$S3TemplateLocation" \
        "TargetGroupArn=$ThisAppTargetGroupArn" \
        "EnvironmentFile=arn:aws:s3:::$s3Object" \
        "Image=$image" \
    --template-file $stackFileLocationInYourWorkspace \
    --capabilities CAPABILITY_NAMED_IAM \
    --no-fail-on-empty-changeset

Comments

0

Paratmeter and resources are two different componenets. One "}" is missing at the end of parameter section.

Comments

0

Mi personal case, by mistake I deleted the keyword Mappings:

Before:

  ELBAccountConfig:
    us-east-1:
      AWSAccountNumber: 'XXXXXXX'
    us-east-2:
      AWSAccountNumber: 'XXXXXXX'
    us-west-1:
      AWSAccountNumber: 'XXXXXXX'
    us-west-2:
      AWSAccountNumber: 'XXXXXXX'

After:

Mappings:
  ELBAccountConfig:
    us-east-1:
      AWSAccountNumber: 'XXXXXXX'
    us-east-2:
      AWSAccountNumber: 'XXXXXXX'
    us-west-1:
      AWSAccountNumber: 'XXXXXXX'
    us-west-2:
      AWSAccountNumber: 'XXXXXXX'

Comments

0

I ran into the same error Template format error: Invalid outputs property : [Type, Properties] , because I added a couple new resources, but they were below the Outputs block (I just threw the new resources in at the end of the template) but they need to be in the resource block.

2 Comments

This does not really answer the question. If you have a different question, you can ask it by clicking Ask Question. To get notified when this question gets new answers, you can follow this question. Once you have enough reputation, you can also add a bounty to draw more attention to this question. - From Review
As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.