Gab*_*iel 6 validation templates amazon-ec2 amazon-web-services
我正在尝试创建要使用的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"}
}
},
"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" } } ] }
},
Run Code Online (Sandbox Code Playgroud)
我在底部还有更多事情要执行,例如要执行的bash脚本,但我无法通过此单个问题。我想念什么?
我在寻找相同错误消息的解决方案时遇到了这个问题。
就我而言,我遇到了错误:
无效的模板参数属性“属性”
这是因为我已经在模板的“参数”:{}部分而不是“资源”:{}部分中放置了资源定义。
该错误消息是这样的,因为资源有一个“属性”部分,但是“属性”对参数无效。
小智 5
当我尝试将输出添加到我的模板时,我遇到了相同的错误消息。
$ 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'
Run Code Online (Sandbox Code Playgroud)
我的问题是我在“资源”下而不是之后添加了输出。
不正确
{
"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" ] }
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
正确的
{
"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" ] }
}
}
}
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
18924 次 |
最近记录: |