Correct stack drift

更新时间:
复制 MD 格式

Correcting stack drift ensures configuration consistency by synchronizing your stack resources with their definitions in the stack template.

Scenarios

If a resource's actual configuration differs from the template, you can correct the drift to align the resource with the template's definition.

Prerequisites

Drift has been detected on the stack. For more information, see Detect stack drift.

Background information

You can correct stack drift by using one of the following methods:

  • Update the stack: This aligns the resources with the template. For more information, see Update a stack.

  • Correct the template: This updates the template to match the actual resource configurations.

Methods

Using the ROS console

  1. Log in to the ROS console.

  2. In the navigation pane on the left, click Stacks.

  3. On the Stacks page, click the name of the target stack.

  4. Click the Drift tab.

  5. On the Drift page, click Detect Stack Drift.

  6. In the Stack Drift Status section, click Correct.

    Note

    The Correct button appears only for stacks that are in a drifted state.

  7. In the Drift Correction dialog box, in the Resource List, select the drifted resources to correct.

  8. In the Drift Correction dialog box, click Preview to review the changes to the template.

  9. Click OK to apply the correction.

    After the correction is complete, run drift detection again to view the results.

Using the Alibaba Cloud CLI

Run the aliyun ros UpdateStackTemplateByResources command to correct a drifted stack template. The command parameters are the same as the parameters for the UpdateStackTemplateByResources API operation. For more information, see UpdateStackTemplateByResources.

$ aliyun ros UpdateStackTemplateByResources --StackId 4334b961-3bfd-419e-9a00-23a95e******

Related documentation

Drift detection status codes