首页 > 解决方案 > 遇到不受支持的属性 SourceSecurityGroupId

问题描述

我正在尝试为创建 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

标签: amazon-web-servicesamazon-cloudformation

解决方案


其实看起来不错。您能否尝试将安全组与 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"
        }
    }
},

推荐阅读