全部產品
Search
文件中心

Resource Orchestration Service:ALIYUN::VPC::RouteTable

更新時間:Mar 28, 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"
        ]
      }
    }
  }
}