Resource Orchestration Service (ROS) allows you to manage related resources as a single unit called a stack. This topic describes how to create a stack.

Background information

You can use one of the following methods to create a stack:

  • Use new resources (standard): Create a stack by using new resources.

    If you use one of your templates or sample templates to create a stack, new resources are automatically created. For more information, see Use new resources.

  • Use existing resources (resource import): Create a stack by importing existing resources.

    You can import existing resources to ROS for centralized management. For more information, see Use existing resources.

Use new resources

  1. Log on to the ROS console.
  2. In the left-side navigation pane, click Stacks.
  3. In the upper-left corner, select the region where you want to create the stack from the drop-down list.
  4. On the Stacks page, click Create Stack and select Use New Resources (Standard) from the drop-down list.
  5. In the Select Template step, specify a template, and click Next.
    • Select an Existing Template: Select an existing template and then configure the parameters.
      • Use URL: Enter the URL of the template that you selected and click Extract JSON Content. The system automatically completes the template content.
      • Enter Template Content: In the Template Content section, enter the content of a JSON, YAML, or Terraform template. For information about how to compile a JSON or YAML template, see Template structure. For information about how to compile a Terraform template, see Terraform template structure.
      • My Templates: Select an existing template and a template version. The system automatically completes the template content. For information about how to create a template, see Create a template.
      • Shared Template: Select a shared template and a template version. The system automatically completes the template content. For information about how to share a template, see Share a template.
      • Upload Template: Click Upload File to upload a JSON or YAML template. The system automatically completes the template content.
  6. In the Configure Template Parameters step, configure Stack Name and other parameters and click Next.
    Note The parameters that you need to configure vary based on the templates. Follow the on-screen instructions to configure the parameters.
  7. In the Configure Stack step, configure the parameters described in the following table, and click Next.
    Parameter Description
    Stack Policy Valid values:
    • No Stack Policy: No stack policy is specified.
    • Input Stack Policy: You must upload a stack policy file or enter a stack policy in the JSON or YAML format.

    For more information about stack policies, see Stack policies.

    Rollback on Failure Valid values:
    • Enabled: A rollback is triggered when a stack fails to be created.
    • Disabled: A rollback is not triggered when a stack fails to be created.
    Timeout Period If a resource failed to be created or updated within the time limit specified by Timeout Period, the system rolls the resource back to the status before the resource is created or updated.

    Valid values: 10 to 1440.

    Unit: minutes.

    Deletion Protection This feature protects the stack from accidental delete operations. Valid values:
    • Enabled: enables deletion protection.
    • Disabled: disables deletion protection.
    RAM Role You can create a RAM role and assign it to ROS as a trusted entity. Then, you can grant minimal permissions to the RAM role based on the requirements of resources defined in the template.
    Tags Each tag is a key-value pair that can be used to classify stacks.

    To add a tag, click Add. In the Edit tag dialog box, configure Tag Key and Tag Value, and then click Confirm.

    Resource Group You can specify a resource group in which you want to create the stack. If you do not specify a resource group, the stack is added to the default resource group.

    For more information, see Create a resource group.

  8. In the Check and Confirm step, click Create.
    After the stack is created, Created is displayed in the Status column of the stack.

Use existing resources

An elastic IP address (EIP) resource is used in the example.

  • The resource identifier property of the instance that is associated with the EIP is obtained.

    In this example, the obtained resource identifier property of the instance that is associated with the EIP is AllocationId. For more information, see Obtain a resource identifier property for resource import.

  • The ID of the instance that is associated with the EIP is obtained.

    Log on to the EIP console to obtain the ID of the EIP that you want to import.

  1. Log on to the ROS console.
  2. In the left-side navigation pane, click Stacks.
  3. In the upper-left corner of the page, select a region from the drop-down list.
    Note Make sure that the resource that you want to import resides in the same region as the stack.
  4. On the Stacks page, click Create Stack and select Use Existing Resources (Resource Import) from the drop-down list.
  5. In the Select Template step of the Use Existing Resources wizard, click Select an Existing Template in the Specify Template section. Set Template Import Method to Enter Template Content. In the Template Content code editor, enter the following template content in the JSON format. Then, click Next.
    {
      "ROSTemplateFormatVersion": "2015-09-01",
      "Resources": {
        "Eip": {
          "Type": "ALIYUN::VPC::EIP",
          "DeletionPolicy": "Retain",
          "Properties": {
            "Bandwidth": 5
          }
        }
      },
      "Outputs": {
        "EipAddress": {
          "Value": {
            "Fn::GetAtt": [
              "Eip",
              "EipAddress"
            ]
          }
        },
        "AllocationId": {
          "Value": {
            "Fn::GetAtt": [
              "Eip",
              "AllocationId"
            ]
          }
        }
      }
    }
    Note The DeletionPolicy parameter is set to Retain, which indicates that the resource is retained when it is removed from a stack. To prevent resources from being unexpectedly deleted, we recommend that you set the DeletionPolicy parameter to Retain.
  6. In the Identify Resources step of the Use Existing Resources wizard, enter a resource identifier value such as eip-bp140qv3j25nsfaqd****. Then, click Next.
    Import Resourses
  7. In the Configure Template Parameters step of the Use Existing Resources wizard, configure Stack Name and Change Set Name. Then, click Next.
  8. In the Configure Stack step, configure the parameters and click Next.
    In this example, the default settings are used. For more information, see the Parameters table in this topic.
  9. In the Check and Confirm step of the Use Existing Resources wizard, click Create Stack and Import Change Set.
  10. On the Change Sets tab of the stack management page, click Execute in the Actions column that corresponds to the change set to start the resource import.
    Change set
Execution results

On the Stack Information tab, if Created After Resource Import is displayed on the right side of Status in the Basic Information section, the resource is imported.

What to do next

To check whether the template of the imported resource matches the actual template, click Drift Detection on the right side of Drift Status on the Stack Information tab. For more information, see Detect drift on a stack.