ALIYUN::VPC::RouteTable类型用于创建一个自定义路由表。

目前不支持在以下地域创建路由表:
  • 华北2(北京)
  • 华南1(深圳)
  • 华东1(杭州)

语法

{
  "Type": "ALIYUN::VPC::RouteTable",
  "Properties": {
    "RouteTableName": String,
    "VpcId": String,
    "Description": String,
    "Tags": List
  }
}

属性

属性名称类型必须允许更新描述约束
VpcIdString自定义路由表所属的VPC ID。
RouteTableNameString路由表的名称。长度为2~128个字符。必须以英文字母或汉字开头,不能以http://https://开头。可包含英文字母、汉字、数字、英文句点(.)、下划线(_)和短划线(-)。
DescriptionString路由表的描述信息。长度为2~256个字符。必须以英文字母或汉字开头,不能以http://https://开头。
TagsList标签。最多设置20个标签,每个标签由键值对组成。标签值可以为空。

详情请参见Tags属性

Tags语法

"Tags": [
  {
    "Value": String,
    "Key": String
  }
]  

Tags属性

属性名称类型必须允许更新描述约束
KeyString标签键长度为1~128个字符,不能以aliyunacs:开头,不能包含http://或者https://
ValueString标签值长度为0~128个字符,不能以aliyunacs:开头,不能包含http://或者https://

返回值

Fn::GetAtt

  • RouteTableId:路由表ID。
  • VpcId:自定义路由表所属的VPC ID。
  • RouteTableName:路由表的名称。
  • RouteTableType:路由表的类型。
  • VSwitchIds:VPC下的交换机列表。

示例

  • YAML格式

    ROSTemplateFormatVersion: '2015-09-01'
    Parameters:
      RouteTableName:
        Type: String
        Description: The name of the route table.The name must be 2 to 128 characters in length. It can contain letters, numbers, periods (.), underscores (_), and hyphens (-). It must start with a letter and cannot start with http:// or https://.
      VpcId:
        Type: String
        AssociationProperty: ALIYUN::ECS::VPC::VPCId
    Resources:
      RouteTable:
        Type: ALIYUN::VPC::RouteTable
        Properties:
          RouteTableName: TestRouteTable
          VpcId:
            Ref: VpcId
    Outputs:
      RouteTableId:
        Description: The ID of the route table.
        Value:
          Fn::GetAtt:
            - RouteTable
            - RouteTableId
      VpcId:
        Description: The ID of the VRouter to which the route table belongs.
        Value:
          Fn::GetAtt:
            - RouteTable
            - VpcId
      RouteTableType:
        Description: The type of the route table.
        Value:
          Fn::GetAtt:
            - RouteTable
            - RouteTableType
      VSwitchIds:
        Description: A list of VSwitches under the VPC.
        Value:
          Fn::GetAtt:
            - RouteTable
            - VSwitchIds
      RouteTableName:
        Description: The name of the route table.
        Value:
          Fn::GetAtt:
            - RouteTable
            - RouteTableName            
  • JSON格式

    {
      "ROSTemplateFormatVersion": "2015-09-01",
      "Parameters": {
        "RouteTableName": {
          "Type": "String",
          "Description": "The name of the route table.The name must be 2 to 128 characters in length. It can contain letters, numbers, periods (.), underscores (_), and hyphens (-). It must start with a letter and cannot start with http:// or https://."
        },
        "VpcId": {
          "Type": "String",
          "AssociationProperty": "ALIYUN::ECS::VPC::VPCId"
        }
      },
      "Resources": {
        "RouteTable": {
          "Type": "ALIYUN::VPC::RouteTable",
          "Properties": {
            "RouteTableName": "TestRouteTable",
            "VpcId": {
              "Ref": "VpcId"
            }
          }
        }
      },
      "Outputs": {
        "RouteTableId": {
          "Description": "The ID of the route table.",
          "Value": {
            "Fn::GetAtt": [
              "RouteTable",
              "RouteTableId"
            ]
          }
        },
        "VpcId": {
          "Description": "The ID of the VRouter to which the route table belongs.",
          "Value": {
            "Fn::GetAtt": [
              "RouteTable",
              "VpcId"
            ]
          }
        },
        "RouteTableType": {
          "Description": "The type of the route table.",
          "Value": {
            "Fn::GetAtt": [
              "RouteTable",
              "RouteTableType"
            ]
          }
        },
        "VSwitchIds": {
          "Description": "A list of VSwitches under the VPC.",
          "Value": {
            "Fn::GetAtt": [
              "RouteTable",
              "VSwitchIds"
            ]
          }
        },
        "RouteTableName": {
          "Description": "The name of the route table.",
          "Value": {
            "Fn::GetAtt": [
              "RouteTable",
              "RouteTableName"
            ]
          }
        }
      }
    }