All Products
Search
Document Center

Resource Orchestration Service:Perform a replacement update for a stack resource

Last Updated:Feb 18, 2024

If you want to update a stack resource but you cannot change the resource property, you can perform a replacement update for the resource in the Resource Orchestration Service (ROS) console.

Background information

If you want to change only the resource property of a stack resource but remain the physical ID of the resource unchanged, you can modify the parameter settings in the stack template.

If you want to update a stack resource but you cannot change the resource property, you can use the replacement update feature to replace the resource property. For a replacement update, the existing resource is deleted, a new resource is created, and the physical ID of the resource is changed. This topic describes how to perform a replacement update for a stack resource. In this example, the CidrBlock property of the ALIYUN::ECS::VSwitch resource is replaced.

Procedure

  1. Log on to the ROS console.

  2. Create a stack.

    Use the following template to create a stack that contains the ALIYUN::ECS::VSwitch resource. In this template, the CidrBlock property is set to 172.16.100.0/24.

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

    ROSTemplateFormatVersion: '2015-09-01'
    Parameters:
      ZoneId:
        Type: String
        Default: cn-hangzhou-i
      VSwitchCidrBlock:
        Type: String
        Default: 172.16.100.0/24
    Resources:
      EcsVpc:
        Type: ALIYUN::ECS::VPC
        Properties:
          CidrBlock: 172.16.0.0/12
          VpcName: MyTestVpc
      VSwitch:
        Type: ALIYUN::ECS::VSwitch
        Properties:
          ZoneId:
            Ref: ZoneId
          CidrBlock:
            Ref: VSwitchCidrBlock
          VpcId:
            Fn::GetAtt:
              - EcsVpc
              - VpcId
          VSwitchName: VSwitch
    Outputs: {}
  3. Perform a replacement update on the stack.

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

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

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

    4. In the Configure Template Parameters section of the Configure Parameters step, update the value of VSwitchCidrBlock from 172.16.100.0/24 to 172.16.200.0/24.

    5. In the Configure Stack Settings section, set the Whether to enable replacement update parameter to Enable to enable the replacement update feature.

    6. Click Confirm.

      After the replacement update is complete, the physical ID of the vSwitch is changed. The CidrBlock property of the vSwitch is updated from 172.16.100.0/24 to 172.16.200.0/24. If you want to view the vSwitch details, click the Resources tab on the stack details page, and click the new ID of the vSwitch to go to the details page.