All Products
Search
Document Center

Resource Orchestration Service:Create a stack

Last Updated:Apr 12, 2023

Resource Orchestration Service (ROS) allows you to create a stack and manage a group of resources in the stack. This topic describes how to create a stack.

Background information

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

  • Use New Resources (Standard): Use new resources to create a stack.

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

  • Use Existing Resources (Resource Import): Import existing resources to create a stack.

    You can import existing resources to a stack to manage and orchestrate the resources in a centralized manner. For more information, see Use existing resources to create a stack.

Use new resources to create a stack

  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 the region in which you want to create a 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 based on your business requirements and click Next.

    • Select an Existing Template: Specify the import method for the template and configure the relevant parameters. The following methods are supported:

      • Use URL: Enter the URL of the template and click Extract JSON Content. The template content is autopopulated.

        If you want to use a URL of an ROS template that is stored in an Object Storage Service (OSS) bucket, you must configure cross-origin resource sharing (CORS). For more information, see Configure CORS for a template.

      • Enter Template Content: In the Template Content section, enter the content of a JSON, YAML, or Terraform template. For more information about how to create a JSON or YAML template, see Template structure. For more information about how to create a Terraform template, see Structure of Terraform templates.

      • My Templates: Select an existing template and a template version. The template content is autopopulated. For more information, see Create a template.

      • Shared Template: Select a shared template and a template version. The template content is autopopulated. For more information about how to share a template, see Share a template with Alibaba Cloud accounts.

    • Use a Sample Template: Select a sample template from the Sample Templates drop-down list. The template content is autopopulated.

  6. In the Configure Template Parameters step, specify Stack Name, configure other parameters, and then click Next.

  7. In the Compliance Precheck step, complete compliance precheck and click Next.

    Note

    The compliance precheck feature is available only for specific resources. For more information, see Compliance precheck of ROS.

    1. In the Evaluate Rules section, add an evaluation rule.

      You can add evaluation rules based on the cloud resources in the ROS template.

    2. Click Evaluate.

      You can modify the template content based on the suggestions that are provided to remediate invalid resources to ensure the compliance of the resources.

  8. In the Configure Stack step, configure the following parameters and click Next.

    Note

    The parameters that you configure vary based on the template. Follow the on-screen instructions to configure the parameters.

    Parameter

    Description

    Stack Policy

    Valid values:

    • No Stack Policy: Do not specify a stack policy.

    • Input Stack Policy: Upload a stack policy or enter a stack policy in the text editor.

    For more information about stack policies, see Stack policies.

    Rollback on Failure

    Valid values:

    • Enabled: enables rollback when the stack fails to be created.

    • Disabled: disables rollback when the stack fails to be created.

    Timeout Period

    If all resources failed to be created or updated within the timeout period, the system automatically rolls the resources back to the previous status.

    Valid values: 10 to 1440.

    Unit: minutes.

    Deletion Protection

    This feature prevents the stack from being unintentionally deleted. Valid values:

    • Enabled: enables deletion protection.

    • Disabled: disables deletion protection.

    RAM Role

    You can create a RAM role whose trusted entity is ROS. Then, you can grant the minimum permissions to the RAM role based on the required permissions of resources in the template.

    Tags

    A tag is a key-value pair that you can use to classify stacks.

    You can perform the following operations to add a tag: Click Add. In the Edit tag dialog box, configure Tag key and Tag value, and click Confirm.

    Resource Group

    You can specify a resource group to which the stack belongs. If you do not specify a resource group, the stack is added to the default resource group.

    For more information about how to create a resource group, see Create a resource group.

    Stack Event Callback URLs

    The callback URLs that are used to receive the events of the stack.

  9. In the Check and Confirm step, click Create.

    After the stack is created, Created appears in the Status column of the stack.

Use existing resources to create a stack

The following section describes how to import existing resources to create a stack. In this example, an elastic IP address (EIP) is used.

  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, 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 Configure Template Parameters step, configure Stack Name and Change Set Name, and click Next.
  7. In the Identify Resources step, enter a resource identifier value such as eip-bp140qv3j25nsfaqd****, and click Next.
  8. In the Compliance Precheck step, complete compliance precheck and click Next.

    Note

    The compliance precheck feature is available only for specific resources. For more information, see Compliance precheck of ROS.

    1. In the Evaluate Rules section, add an evaluation rule.

      You can add evaluation rules based on the cloud resources in the ROS template.

    2. Click Evaluate.

      You can modify the template content based on the suggestions that are provided to remediate invalid resources to ensure the compliance of the resources.

  9. In the Configure Stack step, configure the relevant parameters and click Next.

    In this example, the default settings are used. For more information, see the table provided in this topic.

  10. In the Check and Confirm step, click Create Stack and Import Change Set.
  11. 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

Result

On the Stack Information tab, if Created (Resources Imported) appears on the right of Status in the Basic Information section, the EIP is imported.

What to do next

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