All Products
Search
Document Center

Resource Orchestration Service:Move resources between stacks

Last Updated:Apr 16, 2026

This topic describes how to move resources from one stack to another.

Scenarios

A resource can exist in only one stack. If you want to manage a resource using stack B but the resource already exists in stack A, you can remove the resource from stack A without deleting it and then import the resource into stack B. This topic uses an elastic IP address (EIP) as an example to show how to move an EIP from stack A to stack B.

Prerequisites

Make sure that you have created a stack (stack A) that contains an EIP resource. For more information, see ALIYUN::VPC::EIP and Create a stack.

Remove a resource from a stack

In this example, the EIP resource is removed from stack A but retained. This allows the EIP resource to be imported into another stack, stack B. If you want to retain a resource when you remove it from a stack, set the DeletionPolicy attribute of the resource to Retain. For more information, see Background information.

Procedure

  1. Log on to the Resource Orchestration Service (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. Update the deletion policy of the resource. Set the DeletionPolicy of the EIP resource to Retain.

    For more information about the operation, see Update a deletion policy.

    You need to perform this step if the resource does not have DeletionPolicy set, or if DeletionPolicy is set to Delete. You can skip this step if DeletionPolicy is set to Retain.

  5. Remove the EIP resource.

    For more information about the operation, see Remove resources.

Import the resource into a new stack

Note

When you import a resource, you must set the DeletionPolicy attribute. Otherwise, the import fails.

Create a stack using an existing resource

You can create stack B by importing the existing EIP resource. For more information about the operation, see Create a stack from existing resources.

After the operation succeeds, you can view the new stack B in the ROS console. The information about the imported EIP resource is available on the Resources tab of stack B.

The following is a sample template for the resource import:

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

Import an existing resource into a stack

Prerequisites

Make sure that you have created a stack (stack B) that does not contain an EIP resource. For more information about the operation, see Create a stack.

Procedure

You can import the existing EIP resource into stack B. For more information about the operation, see Import existing resources to a stack.

After the operation completes, you can view information about the imported EIP resource on the Resources tab of stack B.

In this example, the template does not contain EIP resources before the resource import, but these resources are added after the import. A sample template is as follows:

Before import

ROSTemplateFormatVersion: '2015-09-01'

After import

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