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

相關問題