2015-08-28 75 views
0

我正在嘗試使用CloudFormation自動化一些構建部署。現在我試圖創建一個公共子網VPC的,但我不斷收到此錯誤資源屬性無效雲信息

A client error (ValidationError) occurred when calling the ValidateTemplate operation: Invalid template resource property 'PublicSubnet' 

我在模板中的部分如下:

 "PublicSubnet" : { 
     "Type": "AWS::EC2::Subnet", 
     "Properties": { 
      "CidrBlock": "10.0.1.0/24", 
      "Tags": [ 
       { 
        "Name": "public-1" 
       }, 
       { 
        "VpcId": { 
         "Ref": "DemoVPC" 
        } 
       } 
      ] 
     }, 

任何指導,將是讚賞。

+0

看起來它可能是間距問題,由於某些原因,它認爲它是一個資源屬性。這很奇怪,因爲它是JSON驗證的。 – efhram

回答

0

的語法爲AWS::EC2::Subnet是:

{ 
    "Type" : "AWS::EC2::Subnet", 
    "Properties" : { 
     "AvailabilityZone" : String, 
     "CidrBlock" : String, 
     "MapPublicIpOnLaunch" : Boolean, 
     "Tags" : [ Resource Tag, ... ], 
     "VpcId" : { "Ref" : String } 
    } 
} 

好像你VpcId裏面Tags當它不應該。該Tag Type具有以下屬性

{ 
    "Key" : String, 
    "Value" : String 
} 
+0

我希望標籤名稱爲「VpcId」,結果證明我錯誤地使用了「標籤」語法。 – efhram

0

如果文檔的JSON結構變形,此錯誤消息通常也會出現。如果沒有良好的工具,很容易與開放式和閉合式托架混淆。