Resource Orchestration Service (ROS) provides the drift detection feature that can help you check whether the actual configurations of your stack are inconsistent with the template configurations of the stack. This topic describes how to detect drift on a stack.
Scenario
If you want to check whether the actual configurations and the defined template configurations of a stack or stack resources are the same, you can use the drift detection feature to detect drift on the stack.
Prerequisites
A stack is created. For more information, see Create a stack.
Limits
You can use the drift detection feature only for a stack that is in one of the following states.
State
Description
CREATE_COMPLETE
The stack is created.
UPDATE_FAILED
The stack fails to be updated.
UPDATE_COMPLETE
The stack is updated.
ROLLBACK_COMPLETE
The resources of the stack are rolled back.
ROLLBACK_FAILED
The resources of the stack fail to be rolled back.
CHECK_COMPLETE
The stack is validated.
CHECK_FAILED
The stack fails to be validated.
You can detect drift only on resources of specific types. For more information, see Resource types that support drift detection and resource import.
Supported methods
ROS console: You can detect drift on a stack in the ROS console.
For more information, see Detect drift on a stack in the ROS console.
ROS API operation: You can detect drift on a stack by calling a specific ROS API operation.
For more information, see DetectStackDrift.
Alibaba Cloud CLI: You can detect drift on a stack by using Alibaba Cloud CLI.
For more information, see Detect drift on a stack by using Alibaba Cloud CLI.
Detect drift on a stack in the ROS console
Log on to the ROS console.
In the left-side navigation pane, click Stacks.
In the top navigation bar, select the region where the stack you want to manage resides from the region drop-down list. For example, select China (Hangzhou).
In the Actions column of the stack, choose
.You can also perform the following steps: Click the stack ID to go to the stack details page. On the Stack Information tab, click Drift Detection.
On the Drifts tab, view the drift information about the stack, such as Drift Status, Last Drift Detection Time, and Resource Drift Status.
Detect drift on a stack by using Alibaba Cloud CLI
Install Alibaba Cloud CLI.
For more information, see Windows.
Configure an Alibaba Cloud credential.
For more information, see Configure a credential in interactive mode (fast).
Detect drift on a stack.
Run the
aliyun ros DetectStackDrift
command to detect drift on the stack that you want to manage.You must specify the stack ID and region ID, as well as the resource names that you want to use as filter conditions for the drift detection operation. For more information, see DetectStackDrift.
aliyun ros DetectStackDrift --RegionId cn-beijing --StackId bc1a154f-d073-4e77-9ae5-323d3b23****