【问题标题】:cloudformation Template format error: Every Resources object must contain a Type membercloudformation 模板格式错误:每个资源对象都必须包含一个类型成员
【发布时间】:2017-05-30 17:57:11
【问题描述】:

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

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

模板:

{
"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 amazon-cloudformation


    【解决方案1】:

    解决了大括号在错误位置的问题。工作模板如下。

    {
    "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" : {
    }}
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-06-21
      • 1970-01-01
      • 2018-03-31
      • 2016-03-21
      • 1970-01-01
      • 1970-01-01
      • 2015-07-17
      • 2017-02-02
      相关资源
      最近更新 更多