All Products
Search
Document Center

Resource Orchestration Service:Import an existing resource to create a stack

Last Updated:Jan 26, 2024

This topic describes how to import an existing resource to create a stack in the Resource Orchestration Service (ROS) console. In the example, an elastic IP address (EIP) is imported.

Scenario

If you want to manage a large number of cloud resources at the same time, you can use resource import to add the cloud resources to a new stack. This way, you can use the stack to manage the cloud resources in a centralized manner and reduce manual intervention.

Prerequisites

Before you import an EIP, make sure that the following operations are complete:

  1. Obtain the resource identifier property of the EIP that you want to import.

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

  2. Obtain the ID of the EIP.

    Log on to the EIP console to obtain the ID of the EIP.

Considerations

You must specify the DeletionPolicy property for the resource that you want to import in the template. If you do not specify this property, the resource fails to be imported. If you specify the DeletionPolicy property, you can choose whether to retain the resource when you delete the stack or remove the resource. For more information, see Background information.

Procedure

  1. Log on to the ROS console.

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

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

  4. On the Stacks page, click Import Resources.

  5. In the Specify Template section of the Select Template step, select Select an Existing Template. Set the Template Import Method parameter to Enter Template Content. In the Template Content code editor, enter the following YAML template. 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

    In the template content, the DeletionPolicy property is set to Retain. A value of Retain specifies that the system retains the resource when you delete the stack. To prevent resources from being unexpectedly deleted, we recommend that you set the DeletionPolicy property to Retain.

  6. In the Configure Parameters step, configure the Stack Name and Change Set Name parameters.

  7. Configure parameters in the Configure Stack Settings section and click Next.

    In this example, the default settings of the parameters are used. For more information, see Create a stack.

  8. In the Identify Resources step, enter the resource identifier value, such as eip-bp140qv3j25nsfaqd****, and click Next.

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

    For more information about the compliance precheck, see Create a stack.

  10. In the Check and Confirm step, click Create Stack and Import Change Set.

  11. On the Change Sets tab of the stack details page, find the change set that you want to manage and click Execute in the Actions column to start the resource import.

  12. On the Stack Information tab, view the status of the stack.

    In the Basic Information section on the Stack Information tab, check whether the value of the Status parameter is Created (Resources Imported). If the parameter value is Created (Resources Imported), the resource is imported.

What to do next