All Products
Search
Document Center

Resource Orchestration Service:Quick Start for stacks

Last Updated:Apr 16, 2026

This topic describes how to write a template, create a stack, view a stack, and delete a stack in Resource Orchestration Service (ROS) to help you get started quickly.

Prerequisites

An Alibaba Cloud account is required. If you do not have one, register an account.

Example scenario

You can use Resource Orchestration Service (ROS) to simultaneously deploy multiple cloud resources and their dependencies, or to deploy the same set of resources in multiple regions. For example, you can deploy ECS instances and VPC-connected instances. ROS provides automated deployment. This topic uses the creation of a virtual private cloud (VPC) and a vSwitch as an example.

Step 1: Write a template

A template is a text file in JSON, YAML, or Terraform format that uses UTF-8 encoding. In a template, you define Alibaba Cloud resources, configure their properties, and specify their dependencies. You can then create a stack based on the template. You can write your own template based on the template structure and supported resource types, or use a sample template. For more information about how to write a template, see Quick Start for writing a template. For more information about template structures, see Structure of JSON and YAML templates and Structure of Terraform templates.

The following sample YAML template shows how to create a VPC and a vSwitch:

Create a VPC and a vSwitch

ROSTemplateFormatVersion: '2015-09-01'
Description: Example of provisioning VPC and vSwitch.
Parameters:
  VpcName:
    Type: String
    Description: The name must be 2 to 128 characters in length and can contain letters, digits, underscores (_), and hyphens (-). It must start with a letter and cannot start with http:// or  https://.
    Default: null
  VpcCidrBlock:
    Type: String
    Description: The CIDR block of the VPC.
    Default: 192.168.0.0/16
    AllowedValues:
      - 10.0.0.0/8
      - 172.16.0.0/12
      - 192.168.0.0/16
  ZoneId:
    Type: String
    Description: Zone ID.
    AssociationProperty: ALIYUN::ECS::Instance::ZoneId
  VSwitchName:
    Type: String
    Description: The name must be 2 to 128 characters in length and can contain letters, digits, underscores (_), and hyphens (-). It must start with a letter and cannot start with http:// or  https://.
    Default: null
  VSwitchCidrBlock:
    Type: String
    Description: The CIDR block of the VSwitch.
    Default: 192.168.0.0/24
    AllowedValues:
      - 10.0.0.0/24
      - 172.16.0.0/24
      - 192.168.0.0/24
  Tags:
    Type: Json
    Description: A maximum of 20 tags can be specified. Each tag is a key-value pair. The tag value can be left empty.
    Default:
      - Key: ros
        Value: beginner-tutorial
Resources:
  Vpc:
    Type: ALIYUN::ECS::VPC
    Properties:
      VpcName:
        Ref: VpcName
      CidrBlock:
        Ref: VpcCidrBlock
      Tags:
        Ref: Tags
  VSwitch:
    Type: ALIYUN::ECS::VSwitch
    Properties:
      VpcId:
        Ref: Vpc
      ZoneId:
        Ref: ZoneId
      VSwitchName:
        Ref: VSwitchName
      CidrBlock:
        Ref: VSwitchCidrBlock
      Tags:
        Ref: Tags
Outputs:
  VpcId:
    Description: The VPC ID allocated by the system.
    Value:
      Fn::GetAtt:
        - Vpc
        - VpcId
  VSwitchId:
    Description: The VSwitch ID allocated by the system.
    Value:
      Fn::GetAtt:
        - VSwitch
        - VSwitchId
                

The following describes the template:

  • ROSTemplateFormatVersion: The version number of the template. The current version is 2015-09-01.

  • Description: The description of the template. You can use this section to describe the purpose and architecture of the resources that the template defines. A detailed description helps other users understand your template.

  • Parameters: The parameters of the template. In this example, the parameters include the VPC name (VpcName), VPC CIDR block (VpcCidrBlock), zone ID (ZoneId), vSwitch name (VSwitchName), vSwitch CIDR block (VSwitchCidrBlock), and tags (Tags). For more information, see Parameters.

  • Resources: The Alibaba Cloud resources that are defined in the template. In this example, a VPC and a vSwitch are created. The resource properties reference the parameters defined in the Parameters section. For more information, see Resources, ALIYUN::ECS::VPC, and ALIYUN::ECS::VSwitch.

  • Outputs: The resource information that is returned after the stack is created. In this example, the VPC ID and vSwitch ID are returned. For more information, see Outputs.

Step 2: Create a stack

  1. Log on to the ROS console.

  2. In the navigation pane on the left, click Stacks.

  3. In the top navigation bar, select the region where you want to create the stack from the region drop-down list, such as China (Hangzhou).

  4. On the Stacks page, click Create Stack. In the Specify Template section, click Select an Existing Template.

    Note
    • If you select Create Template or ROS Infrastructure Composer, you are redirected to the corresponding page.

  5. On the Specify Template page, click Select an Existing Template in the Specify Template section. Set Template Import Method to Enter Template Content. In the Template Content section, click the ROS tab and enter the YAML template from Step 1: Write a template. Click Next.

  6. On the Configure Parameters page, enter a stack name, configure the template parameters, and then click Next.

    For more information about how to configure stack properties, see Create a stack.

    Parameter

    Description

    Example

    VpcName

    Name of the VPC.

    myVPC

    VpcCidrBlock

    CIDR block of the VPC. Valid values:

    • 10.0.0.0/8

    • 172.16.0.0/12

    • 192.168.0.0/16 (default)

    192.168.0.0/16

    ZoneId

    ID of the zone.

    China (Hangzhou) Zone K

    VSwitchName

    Name of the vSwitch.

    myVSwitch

    VSwitchCidrBlock

    CIDR block of the vSwitch. Valid values:

    • 10.0.0.0/24

    • 172.16.0.0/24

    • 192.168.0.0/24

    Note

    The vSwitch and the VPC must be in the same CIDR block.

    192.168.0.0/24

    Tags

    Tags.

    You can add up to 20 tags. Each tag is a key-value pair. The tag value can be empty.

    [{"Key": "ros", "Value": "beginner-tutorial"}]

  7. Click Create.

Step 3: View the stack

  1. In the left-side navigation pane, click Stacks.

  2. In the top navigation bar, select the region where you want to create the stack from the region drop-down list, such as China (Hangzhou).

  3. On the Stacks page, find the stack and click the stack ID in the Stack Name column.

    On the stack management page, you can perform the following operations to view the stack information:

    • Click the Stack Information tab to view information in the Basic information and Stack Policy sections.

    • Click the Event tab to view events that occur during the stack lifecycle.

    • Click the Resources tab to view information about each resource in the stack.

    • Click the Output tab to view information about the outputs specified in the template when you created the stack.

    • Click the Parameter tab to view parameters specified in the template when you created the stack, including the ROS pseudo parameters that start with ALIYUN::.

    • Click the Drift tab to view information in the Stack Drift Status and Resource Drift Status sections.

    • Click the Templates tab to view the template of the stack.

    • Click the Change Sets tab to view the change sets of the stack.

Step 4: Use resources in the stack

After the stack is created, you can use the resources in the stack. For example, you can deploy other Alibaba Cloud resources in the vSwitch that belongs to the VPC.

  1. In the navigation pane on the left of the ROS console, click Stacks.

  2. On the Stacks page, click the ID of the stack that you created.

  3. Click the Resources tab, and then click the resource ID of the vSwitch.

  4. On the vSwitch details page in the VPC console, you can view basic information about the vSwitch, such as its ID, zone, and the ID of the VPC to which it belongs.

  5. You can deploy Alibaba Cloud resources in the vSwitch.

    For more information, see Create cloud resources.

Step 5 (Optional): Update the stack

To update resources in a stack, such as changing the VpcName, you can update the stack.

  1. In the navigation pane on the left of the ROS console, click Stacks.

  2. On the Stacks page, find the stack and click Update in the Actions column.

  3. On the Configure Template Parameters page, modify the parameters. For example, change the value of VpcName to testVPC.

  4. Click Modify.

Step 6 (Optional): Delete the stack

When you no longer need the resources in a stack, you can delete the stack. This releases the resources and helps you avoid unnecessary charges.

  1. In the navigation pane on the left of the ROS console, click Stacks.

  2. On the Stacks page, find the stack and click Delete in the Actions column.

  3. In the Delete Stacks dialog box, set Method to Delete the Stack to Release Resources.

  4. Click OK.

What to do next