Amazon web services AWS CFN“;参数groupName不能与参数subnet一起使用;

Amazon web services AWS CFN“;参数groupName不能与参数subnet一起使用;,amazon-web-services,amazon-cloudformation,Amazon Web Services,Amazon Cloudformation,这让我抓狂,无论我尝试什么,在创建堆栈时总是会出现以下错误: *The parameter groupName cannot be used with the parameter subnet* 我已经三次检查了安全组,子网在同一VPC中。任何建议都会很棒,谢谢 { "AWSTemplateFormatVersion" : "2010-09-09", "Description" : "Microsoft SQL 2012 R2 Test Application Stack",

这让我抓狂,无论我尝试什么,在创建堆栈时总是会出现以下错误:

*The parameter groupName cannot be used with the parameter subnet*
我已经三次检查了安全组,子网在同一VPC中。任何建议都会很棒,谢谢

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

  "Description" : "Microsoft SQL 2012 R2 Test Application Stack",

  "Parameters" : {
    "pInstanceName" : {
        "Description" : "Instance name (up to 15 characters)",
        "Type" : "String",
        "MinLength" : "1",
        "MaxLength" : "15",
        "AllowedPattern" : "[a-zA-Z0-9]+",
        "Default" : "aws2xxxxxxxxxxx"
    },
    "pInstanceType" : {
        "Description" : "EC2 instance type",
        "Type" : "String",
        "AllowedValues" : [ "t1.micro", "t2.micro", "t2.small", "t2.medium", "m1.small", "m1.medium", "m1.large", "m1.xlarge", "m2.xlarge", "m2.2xlarge", "m2.4xlarge", "m3.medium", "m3.large", "m3.xlarge", "m3.2xlarge", "m4.large", "m4.xlarge", "m4.2xlarge", "m4.4xlarge", "m4.10xlarge", "c1.medium", "c1.xlarge", "c3.large", "c3.xlarge", "c3.2xlarge", "c3.4xlarge", "c3.8xlarge", "c4.large", "c4.xlarge", "c4.2xlarge", "c4.4xlarge", "c4.8xlarge", "g2.2xlarge", "r3.large", "r3.xlarge", "r3.2xlarge", "r3.4xlarge", "r3.8xlarge", "i2.xlarge", "i2.2xlarge", "i2.4xlarge", "i2.8xlarge", "d2.xlarge", "d2.2xlarge", "d2.4xlarge", "d2.8xlarge", "hi1.4xlarge", "hs1.8xlarge", "cr1.8xlarge", "cc2.8xlarge", "cg1.4xlarge"],
        "ConstraintDescription" : "must be a valid EC2 instance type",
        "Default" : "t2.small"
    },
    "pAmi" : {
        "Description" : "AMI required to provision instance",
        "Type" : "String",
        "Default" : "ami-55084526"
    },
    "pVolumeSize" : {
        "Description" : "Root volume size",
        "Type" : "String",
        "Default" : "60"
    },
    "pKeyPairName" : {
        "Description" : "Name of key pair to use",
        "Type" : "String",
        "Default" : "win_keys"
    },
    "pAz" : {
        "Description" : "Availability Zone of instance",
        "Type" : "String",
        "AllowedValues" : [
            "eu-west-1b",
            "eu-west-1c"
        ],
        "Default" : "eu-west-1b"
    },
    "pVpcId" : {
        "Description" : "VPC-ID",
        "Type" : "AWS::EC2::VPC::Id",
        "Default" : "vpc-7xxxx513"
    },
    "pVpcName" : {
        "Description" : "VPC of instance",
        "Type" : "String",
        "MinLength" : "3",
        "MaxLength" : "4",
        "AllowedPattern" : "^(aws)\\d",
        "Default" : "aws"
    },
    "pEnvironment" : {
        "Description" : "Environment",
        "Type" : "String",
        "Default" : "preProduction",
        "AllowedValues" : [
            "development",
            "test",
            "preProduction",
            "production"
        ],
        "ConstraintDescription" : "specify environment stack"
    },
    "pSystem" : {
        "Description" : "Application or System instance is part of",
        "Type" : "String",
        "Default" : "n/a"
    },
    "pDefaultSg" : {
        "Description" : "Default VPC Security Groups",
        "Type" : "List<AWS::EC2::SecurityGroup::Id>",
        "Default" : "sg-24xxxx41,sg-2xxxx342,sg-235bxxxx" 
    },
    "pServerRole" : {
        "Description" : "Role of the instance",
        "Type" : "String",
        "Default" : "n/a"
    },
    "pOwnerContact" : {
        "Description" : "Owner email address responsible for instance",
        "Type" : "String",
        "AllowedPattern" : "([a-zA-Z0-9]|-|\\.)+@([a-zA-Z0-9]|-|\\.)+",
        "ConstraintDescription" : "Owner email address: email@domain.com",
        "Default" : "xxxx@domain.com"
    },
    "pDepartment" : {
        "Description" : "Department responsible for instance ",
        "Type" : "String",
        "Default" : "n/a"
    },
    "pProjectCode" : {
        "Description" : "Project or Cost Centre code",
        "Type" : "String",
        "MinLength" : "1",
        "MaxLength" : "30",
        "Default" : "n/a"
    },
    "pVersion" : {
        "Description" : "Version of resource",
        "Type" : "String",
        "Default" : "n/a"
    },
    "pCreationDate" : {
        "Description" : "Creation date of instance",
        "Type" : "String",
        "AllowedPattern" : "^\\d{4}(-\\d{2}){2}",
        "Default" : "2016-10-25"
    }
  },    
  "Resources" : {
    "sgTestPre" : {
        "Type" : "AWS::EC2::SecurityGroup",
            "Properties" : {
                "GroupDescription" : "Security Group for Test environments",
                "VpcId" : { "Ref" : "pVpcId" },
                "SecurityGroupIngress" : [ {
                    "IpProtocol" : "tcp",
                    "FromPort" : "3389",
                    "ToPort" : "3389",
                    "CidrIp" : "192.168.0.0/16"
                } ]
            }
    },
    "ec2Instance" : {
        "Type" : "AWS::EC2::Instance",
        "Properties" : {
            "ImageId" : { "Ref" : "pAmi" },
            "InstanceType" : { "Ref" : "pInstanceType" },
            "KeyName" : { "Ref" : "pKeyPairName" },
            "SecurityGroupIds" : [
                {"Fn::Join":
                    [",",
                        {"Ref": "pDefaultSg"}
                    ]
                },
                { "Fn::GetAtt": ["sgTestPre", "GroupId"] }
            ],
            "SubnetId" : "subnet-3xxxx948",
            "BlockDeviceMappings" : [ {
                "DeviceName" : "/dev/sda1",
                "Ebs" : { "VolumeSize" : {"Ref": "pVolumeSize"} }
            } ],
            "Tags" : [
                {
                    "Key" : "Name",
                    "Value" : { "Ref" : "pInstanceName" }
                },
                {
                    "Key" : "Environment",
                    "Value" : { "Ref" : "pEnvironment" }
                },
                {
                    "Key" : "System",
                    "Value" : { "Ref" : "pSystem" }
                },
                {
                    "Key" : "ServerRole",
                    "Value" : { "Ref" : "pServerRole" }
                },
                {
                    "Key" : "OwnerContact",
                    "Value" : { "Ref" : "pOwnerContact" }
                },
                {
                    "Key" : "Department",
                    "Value" : { "Ref" : "pDepartment" }
                },
                {
                    "Key" : "ProjectCode",
                    "Value" : { "Ref" : "pProjectCode" }
                },
                {
                    "Key" : "VpcName",
                    "Value" : { "Ref" : "pVpcName" }
                },
                {
                    "Key" : "Version",
                    "Value" : { "Ref" : "pVersion" }
                },
                {
                    "Key" : "CreationDate",
                    "Value" : { "Ref" : "pCreationDate" }
                }
            ]
        }
    }
  },
  "Outputs" : {
  }
}
{
“AWSTemplateFormatVersion”:“2010-09-09”,
“说明”:“Microsoft SQL 2012 R2测试应用程序堆栈”,
“参数”:{
“pInstanceName”:{
“说明”:“实例名称(最多15个字符)”,
“类型”:“字符串”,
“最小长度”:“1”,
“最大长度”:“15”,
“允许模式”:“[a-zA-Z0-9]+”,
“默认值”:“AWS2xxxxxxxxxx”
},
“pInstanceType”:{
“说明”:“EC2实例类型”,
“类型”:“字符串”,
“允许值”:[“t1.micro”、“t2.micro”、“t2.small”、“t2.medium”、“m1.small”、“m1.medium”、“m1.large”、“m2.xlarge”、“m2.2xlarge”、“m2.4xlarge”、“m3.medium”、“m3.large”、“m3.xlarge”、“m3.2xlarge”、“m4.2xlarge”、“m4.2xlarge”、“c1.xlarge”、“c3.large”、“c3.xlarge”、“c3.2xlarge”,“c3.4XL”、“c3.8XL”、“c4.XL”、“c4.2xlarge”、“c4.4XL”、“c4.8XL”、“g2.2xlarge”、“r3.XL”、“r3.2xlarge”、“r3.2xlarge”、“r3.4XL”、“r3.8XL”、“i2.xlarge”、“i2.4XL”、“i2.8XL”、“d2.xlarge”、“d2.2xlarge”、“d2.4XL”、“d2.8XL”、“d2.8XL”、“hi1.4XL”、“hs1.8XL”、“cc2.8XL”、”cg1.4XL“],
“ConstraintDescription”:“必须是有效的EC2实例类型”,
“默认值”:“t2.small”
},
“帕米”:{
“说明”:“AMI需要配置实例”,
“类型”:“字符串”,
“默认值”:“ami-55084526”
},
“pVolumeSize”:{
“说明”:“根卷大小”,
“类型”:“字符串”,
“默认值”:“60”
},
“pKeyPairName”:{
“说明”:“要使用的密钥对的名称”,
“类型”:“字符串”,
“默认值”:“赢得密钥”
},
“和平”:{
“说明”:“实例可用区”,
“类型”:“字符串”,
“允许值”:[
“eu-west-1b”,
“eu-west-1c”
],
“默认值”:“eu-west-1b”
},
“pVpcId”:{
“说明”:“VPC-ID”,
“类型”:“AWS::EC2::VPC::Id”,
“默认值”:“vpc-7XX513”
},
“pVpcName”:{
“说明”:“实例专有网络”,
“类型”:“字符串”,
“最小长度”:“3”,
“最大长度”:“4”,
“AllowedPattern”:“^(aws)\\d”,
“默认值”:“aws”
},
“虚拟环境”:{
“说明”:“环境”,
“类型”:“字符串”,
“默认值”:“预生产”,
“允许值”:[
“发展”,
“测试”,
“试生产”,
“生产”
],
“ConstraintDescription”:“指定环境堆栈”
},
“pSystem”:{
“说明”:“应用程序或系统实例是其中的一部分”,
“类型”:“字符串”,
“默认值”:“不适用”
},
“pDefaultSg”:{
“说明”:“默认VPC安全组”,
“类型”:“列表”,
“默认值”:“sg-24xxxx41、sg-2xxxx342、sg-235Bxxxxx”
},
“pServerRole”:{
“说明”:“实例的角色”,
“类型”:“字符串”,
“默认值”:“不适用”
},
“pOwnerContact”:{
“说明”:“负责实例的所有者电子邮件地址”,
“类型”:“字符串”,
“AllowedPattern:“([a-zA-Z0-9]|-| \.)+@([a-zA-Z0-9]|-| \.)+”,
“ConstraintDescription”:“所有者电子邮件地址:email@domain.com",
“默认值”:xxxx@domain.com"
},
“pDepartment”:{
“说明”:“实例负责部门”,
“类型”:“字符串”,
“默认值”:“不适用”
},
“项目代码”:{
“说明”:“项目或成本中心代码”,
“类型”:“字符串”,
“最小长度”:“1”,
“最大长度”:“30”,
“默认值”:“不适用”
},
“pVersion”:{
“说明”:“资源版本”,
“类型”:“字符串”,
“默认值”:“不适用”
},
“pCreationDate”:{
“说明”:“实例创建日期”,
“类型”:“字符串”,
“AllowedPattern”:“^\\d{4}(-\\d{2}{2}”,
“违约”:“2016-10-25”
}
},    
“资源”:{
“sgTestPre”:{
“类型”:“AWS::EC2::SecurityGroup”,
“财产”:{
“GroupDescription”:“测试环境的安全组”,
“VpcId”:{“Ref”:“pVpcId”},
“SecurityGroupIngress”:[{
“IpProtocol”:“tcp”,
“FromPort”:“3389”,
“托波特”:“3389”,
“CidrIp”:“192.168.0.0/16”
} ]
}
},
“EC2状态”:{
“类型”:“AWS::EC2::实例”,
“财产”:{
“ImageId”:{“Ref”:“pAmi”},
“InstanceType”:{“Ref”:“pInstanceType”},
“KeyName”:{“Ref”:“pKeyPairName”},
“SecurityGroupId”:[
{“Fn::Join”:
[",",
{“Ref”:“pDefaultSg”}
]
},
{“Fn::GetAtt”:[“sgTestPre”,“GroupId”]}
],
“子网”:“子网-3xxx948”,
“区块设备应用程序”:[{
“DeviceName”:“/dev/sda1”,
“Ebs”:{“VolumeSize”:{“Ref”:“pVolumeSize”}
} ],
“标签”:[
{
“键”:“名称”,
“值”:{“Ref”:“pInstanceName”}
},
{
“密钥”:“环境”,
“值”:{“Ref”:“pEnvironment”}
},
{
“密钥”:“系统”,
“值”:{“Ref”:“pSystem”}
},
"pDefaultSg" : {
    "Description" : "Default VPC Security Groups",
    "Type": "CommaDelimitedList",
    "Default" : "sg-xxxxx,sg-xxxxx,sg-xxxx" 
},
"SecurityGroupIds" : [{ "Fn::Select" : [ "0", {"Ref" : "pDefaultSg"} ] },{ "Fn::Select" : [ "1", {"Ref" : "pDefaultSg"} ] },{ "Fn::Select" : [ "2", {"Ref" : "pDefaultSg"} ] },{ "Fn::GetAtt": ["sgTestPre", "GroupId"] }],
"MyEc2Instance": {
  "Type": "AWS::EC2::Instance",
  "Properties": {
      "AvailabilityZone": "us-east-1a",
      "ImageId": "ami-04bf6dcdc9ab498ca",
      "InstanceType": "t2.micro",
      "KeyName": { "Ref": "MyKeyName" },
      "SecurityGroupIds": [{ "Fn::GetAtt" : ["MySecurityGroup", "GroupId"] }],
      "SourceDestCheck": false,
      "SubnetId": { "Ref": "MySubnet" }
    }
},