gpt4 book ai didi

amazon-vpc - cloudformation模板格式错误: Every Resources object must contain a Type member

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

嗨,我希望有人能帮助告诉我我做错了什么。我正在编写一个 CF 模板,仅将 VPN 网关添加到 VPC。无需更新路由表等。

我正在使用下面的模板,但我收到一个错误,我无法完全看到问题,我认为额外的一双眼睛可能会有所帮助!:模板验证错误:模板格式错误:每个资源对象都必须包含类型成员。

模板:

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

"Description" : "CF Just add a VPN Gateway to a VPC ",

"Parameters" : {

"targetVPCtoAttachGatewayTo" : {
"Description" : "VPC ID to attach VPN Gateway",
"Default" : "vpc-xxxxx",
"Type": "AWS::EC2::VPC::Id"
}
},

"Resources" : {

"VPNGateway" : {
"Type" : "AWS::EC2::VPNGateway",
"Properties" : {
"Type" : "ipsec.1",
"Tags" : [
{"Key": "Name", "Value": {"Fn::Join": ["",["Virtual Private Gateway for ", { "Ref": "targetVPCtoAttachGatewayTo"} ] ]}}]
}
},

"AttachVpnGateway" : {
"Type" : "AWS::EC2::VPCGatewayAttachment",
"DependsOn" : "VPNGateway",
"Properties" : {
"VpcId" : { "Ref" : "targetVPCtoAttachGatewayTo" },
"VpnGatewayId" : { "Ref" : "VPNGateway" }
}
},

"Outputs" : {
}}}

最佳答案

已解决问题,大括号位置错误。下面的工作模板。

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

"Description" : "CF Just add a VPN Gateway to a VPC ",

"Parameters" : {

"targetVPCtoAttachGatewayTo" : {
"Description" : "VPC ID to attach VPN Gateway",
"Default" : "vpc-xxxxx",
"Type": "AWS::EC2::VPC::Id"
}
},

"Resources" : {

"VPNGateway" : {
"Type" : "AWS::EC2::VPNGateway",
"Properties" : {
"Type" : "ipsec.1",
"Tags" : [
{"Key": "Name", "Value": {"Fn::Join": ["",["Virtual Private Gateway for ", { "Ref": "targetVPCtoAttachGatewayTo"} ] ]}}]
}
},

"AttachVpnGateway" : {
"Type" : "AWS::EC2::VPCGatewayAttachment",
"DependsOn" : "VPNGateway",
"Properties" : {
"VpcId" : { "Ref" : "targetVPCtoAttachGatewayTo" },
"VpnGatewayId" : { "Ref" : "VPNGateway" }
}
}
},

"Outputs" : {
}}

关于amazon-vpc - cloudformation模板格式错误: Every Resources object must contain a Type member,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41667181/

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