0

我在Web服务器实例中不断收到此问题。WebServerInstance遇到不受支持的属性VpcId

*Paramaters* 
    VPCSelection": { 
      "Description": "VPC", 
      "Type": "String", 
      "Default": "vpc-xxxxxxx" 

*Webserver Security group* 
    "Resources": { 
     "WebServerSecurityGroup": { 
      "Type": "AWS::EC2::SecurityGroup", 
      "Properties": { 
      "VpcId": { 
       "Ref": "VPCSelection" 
      }, 

*WebServer Instance* 
{ 
    "Resources": { 
    "WebServerSecurityGroup": { 
     "Type": "AWS::EC2::SecurityGroup", 
     "Properties": { 
     "VpcId": { 
      "Ref": "VPCSelection" 
     }, 

当我运行此模板,我得到这个问题:

12:45:52 UTC+0000 ROLLBACK_IN_PROGRESS AWS::CloudFormation::Stack Test13 The following resource(s) failed to create: [WebServerInstance]. . Rollback requested by user. 


12:45:51 UTC+0000 CREATE_FAILED AWS::EC2::Instance WebServerInstance Encountered unsupported property VpcId 

当我从网络服务器实例中删除此VPCid我得到一个不同的错误说:AWS::EC2::Instance WebServerInstance No default VPC for this user

+0

请结帐这个问题,并回答 http://stackoverflow.com/questions/36439206/create-an-ec2-instance-for-a-vpc-not-allowed – mootmoot

+0

谢谢!真的很感激它 – PropK

回答

1

我把这个成浓汤,并得到了下面。这有帮助吗?

{ 
     "Resources": { 
     "WebServerSecurityGroup": { 
      "Type": "AWS::EC2::SecurityGroup", 
      "Metadata": { 
      "YadaYada::Bisque::DotnetType": { 
       "Type": "Bisque.EC2.Networking.SecurityGroup, Bisque.Aws, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" 
      } 
      }, 
      "Properties": { 
      "GroupDescription": { 
       "Ref": "WebServerSecurityGroupGroupDescription" 
      }, 
      "VpcId": { 
       "Ref": "VPCSelection" 
      }, 
      "Tags": [ 
       { 
       "Key": "Name", 
       "Value": "WebServerSecurityGroup" 
       } 
      ] 
      } 
     }, 
     "WebServerInstance": { 
      "Type": "AWS::EC2::Instance", 
      "Metadata": { 
      "YadaYada::Bisque::DotnetType": { 
       "Type": "Bisque.EC2.Instances.Instance, Bisque.Aws, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" 
      }, 
      "AWS::CloudFormation::Init": { 
       "configSets": { 
       "Bootstrap": [ 
        "Bootstrap" 
       ] 
       }, 
       "Bootstrap": { 
       "services": { 
        "windows": { 
        "cfn-hup": { 
         "ensureRunning": true, 
         "enabled": true, 
         "files": [ 
         "c:\\cfn\\hooks.d\\cfn-auto-reloader.conf", 
         "c:\\cfn\\cfn-hup.conf" 
         ] 
        } 
        } 
       }, 
       "files": { 
        "c:\\cfn\\hooks.d\\cfn-auto-reloader.conf": { 
        "content": { 
         "Fn::Join": [ 
         "\n", 
         [ 
          "[cfn-auto-reloader-hook]", 
          "triggers=post.update", 
          "path=Resources.WebServerInstance.Metadata.AWS::CloudFormation::Init", 
          { 
          "Fn::Join": [ 
           "", 
           [ 
           "action=", 
           { 
            "Fn::Join": [ 
            "", 
            [ 
             "cfn-init.exe -v -c \"", 
             "Bootstrap", 
             "\" -s ", 
             { 
             "Ref": "AWS::StackId" 
             }, 
             " -r WebServerInstance --region ", 
             { 
             "Ref": "AWS::Region" 
             } 
            ] 
            ] 
           } 
           ] 
          ] 
          } 
         ] 
         ] 
        } 
        }, 
        "c:\\cfn\\cfn-hup.conf": { 
        "content": { 
         "Fn::Join": [ 
         "\n", 
         [ 
          "[main]", 
          { 
          "Fn::Join": [ 
           "", 
           [ 
           "stack=", 
           { 
            "Ref": "AWS::StackName" 
           } 
           ] 
          ] 
          }, 
          { 
          "Fn::Join": [ 
           "", 
           [ 
           "region=", 
           { 
            "Ref": "AWS::Region" 
           } 
           ] 
          ] 
          }, 
          "interval=1", 
          "verbose=true" 
         ] 
         ] 
        } 
        } 
       } 
       } 
      } 
      }, 
      "Properties": { 
      "SecurityGroupIds": [ 
       { 
       "Ref": "WebServerSecurityGroup" 
       } 
      ], 
      "Tags": [ 
       { 
       "Key": "Name", 
       "Value": "WebServerInstance" 
       } 
      ], 
      "ImageId": { 
       "Ref": "WebServerInstanceImageId" 
      }, 
      "InstanceType": { 
       "Ref": "WebServerInstanceInstanceType" 
      }, 
      "KeyName": { 
       "Ref": "WebServerInstanceKeyName" 
      }, 
      "UserData": { 
       "Fn::Base64": { 
       "Fn::Join": [ 
        "", 
        [ 
        "<script>", 
        { 
         "Fn::Join": [ 
         "", 
         [ 
          "cfn-init.exe -v -c \"", 
          "Bootstrap", 
          "\" -s ", 
          { 
          "Ref": "AWS::StackId" 
          }, 
          " -r WebServerInstance --region ", 
          { 
          "Ref": "AWS::Region" 
          } 
         ] 
         ] 
        }, 
        "</script>" 
        ] 
       ] 
       } 
      } 
      } 
     } 
     }, 
     "Parameters": { 
     "VPCSelection": { 
      "Type": "AWS::EC2::VPC::Id" 
     }, 
     "WebServerSecurityGroupGroupDescription": { 
      "Type": "String" 
     }, 
     "WebServerInstanceImageId": { 
      "Type": "AWS::EC2::Image::Id" 
     }, 
     "WebServerInstanceInstanceType": { 
      "Type": "String", 
      "Default": "t2.micro", 
      "AllowedValues": [ 
      "", 
      "t2.nano", 
      "t2.micro", 
      "t2.small", 
      "t2.medium", 
      "t2.large", 
      "t2.xlarge", 
      "t2.2xlarge", 
      "m4.large", 
      "m4.xlarge", 
      "m4.2xlarge", 
      "m4.4xlarge", 
      "m4.10xlarge", 
      "m3.medium", 
      "m3.large", 
      "m3.xlarge", 
      "m3.2xlarge", 
      "m1.small", 
      "m1.medium", 
      "m1.large", 
      "m1.xlarge", 
      "c4.large", 
      "c4.xlarge", 
      "c4.2xlarge", 
      "c4.4xlarge", 
      "c4.8xlarge", 
      "c3.large", 
      "c3.xlarge", 
      "c3.2xlarge", 
      "c3.4xlarge", 
      "c3.8xlarge", 
      "c1.medium", 
      "c1.xlarge", 
      "cc2.8xlarge", 
      "cc1.4xlarge", 
      "g2.2xlarge", 
      "g2.8xlarge", 
      "cg1.4xlarge", 
      "r3.large", 
      "r3.xlarge", 
      "r3.2xlarge", 
      "r3.4xlarge", 
      "r3.8xlarge", 
      "x1.32xlarge", 
      "m2.xlarge", 
      "m2.2xlarge", 
      "m2.4xlarge", 
      "cr1.8xlarge", 
      "d2.xlarge", 
      "d2.2xlarge", 
      "d2.4xlarge", 
      "d2.8xlarge", 
      "i2.xlarge", 
      "i2.2xlarge", 
      "i2.4xlarge", 
      "i2.8xlarge", 
      "hi1.4xlarge", 
      "hs1.8xlarge", 
      "t1.micro" 
      ] 
     }, 
     "WebServerInstanceKeyName": { 
      "Type": "AWS::EC2::KeyPair::KeyName", 
      "Default": "default" 
     } 
     }, 
     "Metadata": { 
     "AWS::CloudFormation::Interface": { 
      "Key": "AWS::CloudFormation::Interface", 
      "ParameterGroups": [ 
      { 
       "Label": { 
       "default": "WebServerSecurityGroup Properties" 
       }, 
       "Parameters": [ 
       "WebServerSecurityGroupGroupDescription" 
       ] 
      }, 
      { 
       "Label": { 
       "default": "WebServerInstance Properties" 
       }, 
       "Parameters": [ 
       "WebServerInstanceImageId", 
       "WebServerInstanceInstanceType", 
       "WebServerInstanceKeyName" 
       ] 
      } 
      ], 
      "ParameterLabels": { 
      "WebServerSecurityGroupGroupDescription": { 
       "default": "Description" 
      }, 
      "WebServerInstanceImageId": { 
       "default": "Image Id (AMI)" 
      }, 
      "WebServerInstanceInstanceType": { 
       "default": "Instance Size" 
      }, 
      "WebServerInstanceKeyName": { 
       "default": "Key Name" 
      } 
      } 
     } 
     } 
    } 
+0

得到它的工作!谢谢你 – PropK

相关问题