簡體   English   中英

無效的資源屬性cloudformation

[英]Invalid resource property cloudformation

我正在嘗試使用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"
                    }
                }
            ]
        },

任何指導將不勝感激。

如果文檔的JSON結構不正確,通常也會出現此錯誤消息。 如果沒有良好的工具,很容易與開合支架混淆。

AWS :: EC2 :: Subnet的語法為:

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

似乎您的VpcId不應包含在Tags內。 標簽類型具有以下屬性

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

為了創建子網資源,必須使用VpcId和CidrBlock。 盡管您可以將VpcId用作標簽本身,但VpcId應該是“屬性”之一。 有關更多詳細信息,請參閱http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-subnet.html ,尤其是那些表示“ 必需”的內容

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM