遇到不受支持的属性SourceSecurityGroupId

时间:2018-11-14 13:50:51

标签: amazon-web-services amazon-cloudformation

我正在尝试为创建RDS的AWS :: CloudFormation构建模板。但是当我尝试启动模型时,我得到了Encountered unsupported property SourceSecurityGroupId

我使用此参数获取安全组ID

"WebServerSecurityGroupId": {
    "Type": "AWS::EC2::SecurityGroup::Id",
}

我使用的资源:

"Resources": {
    "DBVPCSecurityGroup" : {
        "Type": "AWS::EC2::SecurityGroup",
        "Properties" : {
            "VpcId" : { "Ref" : "VpcId" },
             "SecurityGroupIngress" : [
                {
                    "IpProtocol" : "tcp",
                    "FromPort" : "80",
                    "ToPort" : "80",
                    "SourceSecurityGroupId:" : {
                        "Ref": "WebServerSecurityGroupId"
                    }
                }
            ]
        }
    },
// the rest of template

1 个答案:

答案 0 :(得分:1)

实际上看起来不错。您能否尝试将安全组与Ingress分开:

"DBVPCSecurityGroup" : {
    "Type": "AWS::EC2::SecurityGroup",
    "Properties" : {
        "VpcId" : { "Ref" : "VpcId" }
    }
},
"WebServerSecurityHTTPIn": {
    "Type": "AWS::EC2::SecurityGroupIngress",
    "Properties": {
        "GroupId": {
            "Ref": "DBVPCSecurityGroup"
        },
        "IpProtocol": "tcp",
        "FromPort": "80",
        "ToPort": "80",
        "SourceSecurityGroupId": {
            "Ref": "WebServerSecurityGroupId"
        }
    }
},