全部產品
Search
文件中心

Resource Orchestration Service:將ROS模板匯入為架構圖模板

更新時間:Nov 13, 2025

本文為您介紹,如何將現有的ROS模板匯入為架構圖。

說明
  • 如果ROS模板中不包含布局資訊,ROS架構編輯器將根據演算法進行自動布局,模板的複雜度會影響自動布局的效果。

  • 如果匯入複雜的模板,則可能需要人工調整資源布局,以使架構圖的布局更加合理。

前提條件

確保您已擁有ROS模板,如果沒有請編寫模板,請參見模板快速入門

如果您僅想驗證方案的可行性可使用樣本模板,建立EIP+ECS執行個體:

ROSTemplateFormatVersion: '2015-09-01'
Parameters:
  Zone:
    Type: String
    AssociationProperty: ALIYUN::ECS::Instance::ZoneId
    AssociationPropertyMetadata:
      WithAvailableResource: true
      DefaultValueStrategy: first
    Label:
      en: VSwitch Availability Zone
      zh-cn: 交換器可用性區域
    Default: cn-beijing-f
Resources:
  VPC:
    Type: ALIYUN::ECS::VPC
    Properties:
      CidrBlock: 10.0.0.0/8
      EnableIpv6: false
  VSwitch:
    Type: ALIYUN::ECS::VSwitch
    Properties:
      ZoneId:
        Ref: Zone
      VpcId:
        Ref: VPC
      CidrBlock: 10.0.0.0/24
  SecurityGroup:
    Type: ALIYUN::ECS::SecurityGroup
    Properties:
      VpcId:
        Ref: VPC
  ECSInstance:
    Type: ALIYUN::ECS::Instance
    Properties:
      VSwitchId:
        Ref: VSwitch
      ZoneId:
        Ref: Zone
      VpcId:
        Ref: VPC
      SecurityGroupIds:
        - Ref: SecurityGroup
      SystemDiskSize: 40
      InstanceChargeType: PostPaid
      AllocatePublicIP: false
      IoOptimized: optimized
      ImageId: aliyun_3_x64_20G_qboot_alibase_20230727.vhd
      SystemDiskCategory: cloud_efficiency
      InstanceType: ecs.t5-lc2m1.nano
  EIP:
    Type: ALIYUN::VPC::EIP
    Properties:
      Isp: BGP
      DeletionProtection: false
      Netmode: public
      InstanceChargeType: PayAsYouGo
      InternetChargeType: PayByBandwidth
      Bandwidth: 5
  EIPAssociation:
    Type: ALIYUN::VPC::EIPAssociation
    Properties:
      AllocationId:
        Ref: EIP
      InstanceId:
        Ref: ECSInstance
      Mode: NAT
Metadata:
  ALIYUN::ROS::Composer:
    67cb9fc3:
      Rect:
        - 632
        - 588
        - -184
        - -217
        - 0
        - 0
      ResT: Composer::ROSParameter::AlibabaCloud
      Label: AlibabaCloud
    67cb9fc4:
      Parent: 67cb9fc3
      Rect:
        - 598
        - 523
        - -164
        - -172
        - 1
        - 0
      Reg: cn-beijing
      ResT: Composer::ROSParameter::Region
      Label: 地區
    4ce1a0a6:
      Res:
        - Zone
      Parent: fe688e94
      Rect:
        - 520
        - 320
        - -124
        - -9
        - 3
        - 0
      ResT: Composer::ROSParameter::Zone
      Label: 可用性區域
    fe688e94:
      Res:
        - VPC
      Parent: 67cb9fc4
      Rect:
        - 560
        - 400
        - -144
        - -69
        - 2
        - 0
      Label: Virtual Private Cloud
    a8e63de3:
      Res:
        - VSwitch
      Parent: 4ce1a0a6
      Rect:
        - 480
        - 240
        - -104
        - 51
        - 4
        - 0
      Label: 交換器
    d6a407f2:
      Res:
        - SecurityGroup
      Parent: fe688e94
      Rect:
        - 160
        - 120
        - 30
        - 145
        - 10
        - 0
      Label: 安全性群組
    6d7f85e4:
      Res:
        - ECSInstance
      Parent: a8e63de3
      Rect:
        - 40
        - 40
        - 90
        - 185
        - 11
        - 0
      Layer:
        - d6a407f2
      Label: 雲端服務器執行個體
    69c24097:
      Res:
        - EIP
        - EIPAssociation
      Parent: 67cb9fc4
      Rect:
        - 40
        - 40
        - 90
        - -150
        - 2
        - 0
      Label: Elastic IP Address
    52dd50ee-a0c0-4d13-a3e3-df80fb4c4aa9:
      Parent: 67cb9fc4
      Edge:
        - 69c24097
        - 6d7f85e4
      Line: 0:0:0:#969696:0

操作步驟

  1. 登入ROS架構編輯器控制台

  2. 在左側導覽列,單擊架構模板

  3. 架構模板頁面,單擊建立架構模板,在彈框中選擇ROSTerraform,並單擊確定

    說明

    目前架構圖模板僅支援匯入ROS模板,暫不支援Terraform模板。

  4. 在架構圖模板編輯頁面,單擊左上方image.png,在下拉框中單擊匯入模板內容

  5. 匯入模板內容彈框中,粘貼模板內容,單擊確定,ROS架構編輯器將根據模板內容渲染出架構圖。樣本效果如下圖所示。

    image.png