All Products
Search
Document Center

Resource Orchestration Service:Stack quick start

Last Updated:Aug 25, 2026

Learn how to write a template, create a stack, view a stack, and delete a stack in Resource Orchestration Service (ROS). This guide helps you get started with ROS.

Prerequisites

Make sure that you have an Alibaba Cloud account. If you do not have one, create an account.

Example scenario

If you want to deploy multiple cloud resources and their dependencies at the same time, or deploy cloud resources with the same dependencies across multiple regions, such as ECS instances and VPC-connected instances, you can use Resource Orchestration Service to automate deployment. In this topic, a virtual private cloud (VPC) and a vSwitch are created 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. ROS then creates a stack based on the template. You can write a template based on the template structure and resource types, or use a sample template. For information about how to write a template, see Quick start for writing a template. For more information about template structures, see JSON and YAML template structure and Terraform template structure.

The following code provides a sample YAML template for creating 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 scenario and architecture of the template, which helps users understand its purpose.

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

  • Resources: The Alibaba Cloud resources that are defined in the template. In this example, a VPC and a vSwitch are created. The properties of these resources reference the parameters that are 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 in to the ROS console.

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

  3. In the top navigation bar, select a region 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. On the ROS tab in the Template Content section, enter the YAML template from Step 1: Write a template. Then, click Next.

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

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

    Parameter

    Description

    Example

    VpcName

    The name of the VPC.

    myVPC

    VpcCidrBlock

    The 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

    The ID of the zone.

    Zone K in the China (Hangzhou) region

    VSwitchName

    The name of the vSwitch.

    myVSwitch

    VSwitchCidrBlock

    The 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

    The tags.

    You can specify a maximum of 20 tags. Each tag consists of a key-value pair. The tag value can be empty.

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

  7. Click Create.

Step 3: View a stack

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

  2. In the top navigation bar, select a region 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 Alibaba Cloud resources in the vSwitch of 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 destination stack.

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

  4. In the VPC console, view the basic information about the vSwitch, such as the vSwitch ID, zone, and the ID of the VPC to which the vSwitch belongs.

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

    For more information, see Create cloud resources.

Step 5 (Optional): Update a stack

You can update a stack to modify its resources, such as changing the value of VpcName.

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

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

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

  4. Click Modify.

Step 6 (Optional): Delete a stack

When you no longer need the created resources, you can delete the stack to release the resources and avoid unnecessary charges.

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

  2. On the Stacks page, find the destination 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