全部产品
Search
文档中心

资源编排:ALIYUN::VPC::RouteTable

更新时间:Mar 27, 2026

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

目前不支持在以下地域创建路由表:

  • 华北2(北京)

  • 华南1(深圳)

  • 华东1(杭州)

语法

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

属性

属性名称

类型

必须

允许更新

描述

约束

VpcId

String

自定义路由表所属的VPC ID。

RouteTableName

String

路由表的名称。

长度为2~128个字符。必须以英文字母或汉字开头,不能以http://https://开头。可包含英文字母、汉字、数字、英文句点(.)、下划线(_)和短划线(-)。

Description

String

路由表的描述信息。

长度为2~256个字符。必须以英文字母或汉字开头,不能以http://https://开头。

AssociateType

String

创建的路由表的类型。

取值:

  • VSwitch(默认值):交换机路由表。

  • Gateway:网关路由表。

Tags

List

标签。

最多设置20个标签,每个标签由键值对组成。标签值可以为空。

详情请参见Tags属性

Tags语法

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

Tags属性

属性名称

类型

必须

允许更新

描述

约束

Key

String

标签键

长度为1~128个字符,不能以aliyunacs:开头,不能包含http://或者https://

Value

String

标签值

长度为0~128个字符,不能以aliyunacs:开头,不能包含http://或者https://

返回值

Fn::GetAtt

  • RouteTableId:路由表ID。

  • VpcId:自定义路由表所属的VPC ID。

  • RouteTableName:路由表的名称。

  • RouteTableType:路由表的类型。

  • VSwitchIds:VPC下的交换机列表。

示例

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            
{
  "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"
        ]
      }
    }
  }
}