AWS cloudformation错误:模板验证错误:无效的模板参数属性 [英] AWS cloudformation error: Template validation error: Invalid template parameter property

查看:222
本文介绍了AWS cloudformation错误:模板验证错误:无效的模板参数属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试创建要使用的cloudformation模板,但始终出现上述错误。
这是我的模板中的代码段:

  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}
}
},

资源:{
Ec2Instance:{
Type: AWS :: EC2 :: Instance,
属性:{
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,值:{ Ref: InstanceName}}]}
},

我在底部还有更多事情要执行,例如要执行的bash脚本,但我无法通过此单个问题。我缺少什么?

解决方案

我在寻找同一错误消息的解决方案时遇到了此问题。



在我的情况下,我得到了错误:


无效的模板参数属性属性


这是因为我将资源定义放置在模板的参数:{}部分中,而不是在

该错误消息之所以这样,是因为资源具有属性部分,但是属性对于参数无效。


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?

解决方案

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.

这篇关于AWS cloudformation错误:模板验证错误:无效的模板参数属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆