gpt4 book ai didi

json - 我收到 "Invalid template property or properties"模板验证错误 : Invalid template property or properties [IPAssoc, IPAddress]”

转载 作者:行者123 更新时间:2023-12-03 07:44:48 33 4
gpt4 key购买 nike

您好,下面是我在 AWS 中创建启用了弹性 IP 的实例的模板。但是我不确定我哪里出错了。我已经通过在线 json 验证器验证了 json,仍然面临问题请帮忙

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

"Description" : "My learning template",
"Parameters" : {
"KeyName": {
"Description" : "Name of an existing EC2 KeyPair to enable SSH access to the web server",
"Type": "AWS::EC2::KeyPair::KeyName",
"Default" : "Myvirginiakey",
"ConstraintDescription" : "must be the name of an existing EC2 KeyPair."
},
"EC2InstanceType" : {
"Type" : "String",
"Default" : "t2.micro",
"AllowedValues" : ["t2.micro", "m1.small", "m1.large"],
"Description" : "Enter t2.micro, m1.small, or m1.large. Default is t2.micro."
}
},
"IPAddress" : {
"Type" : "AWS::EC2::EIP"
},
"IPAssoc" : {
"Type" : "AWS::EC2::EIPAssociation",
"Properties" : {
"InstanceId" : { "Ref" : "EC2Instance" },
"EIP" : { "Ref" : "IPAddress" }
}
},
"Resources" : {
"Ec2Instance" : {
"Type" : "AWS::EC2::Instance",
"Properties" : {
"UserData" : { "Fn::Base64" : { "Fn::Join" : [ "", [ "IPAddress=", {"Ref" : "IPAddress"}]]}},
"KeyName" : { "Ref" : "KeyName"},
"ImageId": "ami-0912f71e06545ad88",
"InstanceType" : { "Ref" : "EC2InstanceType"}
}
}
},
"Outputs" : {
}
}

错误信息是:

"Invalid template property or properties"Template validation error: Invalid template property or properties [IPAssoc, IPAddress]"

最佳答案

您需要将 IPAddressIPAssoc 放入资源部分。您的 IPAddress

也有拼写错误

删除这两行并使用:

"Resources" : {
"Ec2Instance" : {
"Type" : "AWS::EC2::Instance",
"Properties" : {
"UserData" : { "Fn::Base64" : { "Fn::Join" : [ "", [ "IPAddress=", {"Ref" : "IPAddress"}]]}},
"KeyName" : { "Ref" : "KeyName"},
"ImageId": "ami-0912f71e06545ad88",
"InstanceType" : { "Ref" : "EC2InstanceType"}
}
},
"IPAddress" : {
"Type" : "AWS::EC2::EIP"
},
"IPAssoc" : {
"Type" : "AWS::EC2::EIPAssociation",
"Properties" : {
"InstanceId" : { "Ref" : "Ec2Instance" },
"EIP" : { "Ref" : "IPAddress" }
}
}
},

关于json - 我收到 "Invalid template property or properties"模板验证错误 : Invalid template property or properties [IPAssoc, IPAddress]”,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52458863/

33 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com