{
    "Resources": {
        "$instanceName": {
            "Properties": {
                "SecurityGroups": [
                    {
                        "Ref": "MsSqlSecurityGroup"
                    }
                ]
            }
        },
        "MsSqlSecurityGroup": {
            "Type": "AWS::EC2::SecurityGroup",
            "Properties": {
                "SecurityGroupIngress": [
                    {
                        "ToPort": "4022",
                        "IpProtocol": "tcp",
                        "FromPort": "4022",
                        "CidrIp": "0.0.0.0/0"
                    },
                    {
                        "ToPort": "135",
                        "IpProtocol": "tcp",
                        "FromPort": "135",
                        "CidrIp": "0.0.0.0/0"
                    },
                    {
                        "FromPort": "1433",
                        "ToPort": "1434",
                        "IpProtocol": "tcp",
                        "CidrIp": "0.0.0.0/0"
                    },
                    {
                        "FromPort": "445",
                        "ToPort": "445",
                        "IpProtocol": "tcp",
                        "CidrIp": "0.0.0.0/0"
                    },
                    {
                        "FromPort": "1024",
                        "ToPort": "65535",
                        "IpProtocol": "tcp",
                        "CidrIp": "0.0.0.0/0"
                    }
                ],
                "GroupDescription": "Enable MS SQL access"
            }
        }
    }
}
