All Products
Search
Document Center

Resource Orchestration Service:Remediate drift on a stack

Last Updated:Feb 02, 2024

You can remediate drift on a stack to synchronize the actual configurations of stack resources with the template definitions. This helps ensure the configuration consistency of resources. This topic describes how to remediate drift on a stack in Resource Orchestration Service (ROS).

Scenario

If you detect that the actual configurations of a stack resource are different from the template configurations, you can remediate drift on the stack to ensure configuration consistency of the resource.

Prerequisites

Drift detection is performed on a stack and the stack has drift. For more information, see Detect drift on a stack.

Background information

You can use one of the following methods to remediate drift on a stack:

  • Method 1: You can update a stack to synchronize resource configurations with their template definitions. For more information, see Update a stack.

  • Method 2: You can remediate a template to synchronize resource configurations with their template definitions. In this example, Method 2 is used.

Methods to remediate a template

Remediate a template in the ROS console

  1. Log on to the ROS console.

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

  3. On the Stacks page, find the stack that you want to manage and click the stack ID.

  4. Click the Drifts tab.

  5. On the Drifts tab, click Detect Stack Drift to detect drift on the stack.

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

    Note

    Correct appears only for stacks that have drifted.

  7. In the Drift Correction dialog box, select the resource whose drift you want to remediate.

  8. In the Drift Correction dialog box, click Preview to compare the template content before and after the remediation.

  9. Click OK.

    After you remediate the resource, detect drift on the stack again and view the detection results.

Remediate a template by using Alibaba Cloud CLI

You can run the aliyun ros UpdateStackTemplateByResources command to remediate drift on the template of a stack. To run the command, you must configure parameters that are the same as the parameters of the UpdateStackTemplateByResources operation. For more information, see UpdateStackTemplateByResources.

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

References

Drift detection status