You can detect whether a stack instance in a stack group differs from its expected configurations or has drifted.
When ROS performs drift detection on a stack group, stacks associated with instances in the stack group are also detected for drift. ROS compares the current and expected configurations of each resource within the stack based on the template and specified parameters. If the current configurations differ from the expected configurations, the resource is considered to have drifted.
- A stack and its associated stack instances are considered to have drifted if one or more of its resources have drifted.
- A stack group is considered to have drifted if one or more of its stack instances have drifted.
Drift refers to changes in stack configurations that are not performed through ROS. Changes directly made through ROS to individual stacks are not considered drift. These changes do not include changes made to stack groups. Assume that you have a stack that is associated with a stack instance in a stack group. If you use ROS to change the stack based on a different template, the stack is not considered to have drifted even if this stack has a different template from other stacks within the same stack group. This is because the stack still matches its expected template and parameter configurations in ROS.
During drift detection on a stack group, each stack within the stack group is detected for drift. Property values that overwrite the original ones specified in the template are used by ROS for drift detection on the stack. If you perform drift detection directly on stacks associated with stack instances, you will not be able to view the drift results on the Stack Groups page.
Detect drift in the ROS console
- Log on to the ROS console.
- In the left-side navigation pane, click Stack Groups.
- On the Stack Groups page, click the the name of the target stack group.
- On the Stack Group Information tab, click the icon, and then select Drift Detection. Note ROS displays a prompt, indicating that a drift detection operation is initiated for the selected stack group.
- In the Drift Detection dialog box that appears, configure Maximum Number of Concurrent Accounts and Fault Tolerance, and then click OK.
- Optional. Click the Operations tab, find the drift detection operation, click View Drift Details, and then view the progress of the drift detection operation.Note
- Only a single drift detection operation on one stack group can be performed at a time. ROS will continue the drift detection operation even if you close the information window.
- The drift detection operation may take several minutes. The actual amount of time it takes for a drift detection operation to complete depends on the number of stack instances and resources in the stack group.
- Click the Instances tab to view the drift detection results.Note
- You can view IDs of the stacks associated with each stack instance in the Stack ID column. You can view the drift status of the stacks in the Drift Status column. A stack is considered to have drifted if one or more of its resources have drifted.
- To view the drift detection results of a stack associated with a specified stack instance, record the Alibaba Cloud account of the stack instance and the stack name and region. Then, log on to the ROS console with the Alibaba Cloud account to which the stack instance belongs to view the drift detection results. For more information, see Detect drift on a stack.
Detect drift through Alibaba Cloud CLI
You can use the following
aliyun ros commands through Alibaba Cloud Command Line Interface (Alibaba Cloud CLI) to detect
drift on a stack group.
||Initiates a drift detection operation on a stack group.|
||Queries the status of the drift detection operation on a stack group.|
||Stops the drift detection operation on a stack group.|
After the drift detection operation is completed, you can use the following subcommands to query the required drift information:
- You can use the
GetStackGroupsubcommand to query detailed information about the stack group, including details about the last completed drift detection operation on the stack group. Information about drift detection operations in progress is not included.
- You can use the
ListStackInstancessubcommand to query the list of instances within a stack group as well as the drift status and last drift detection time of each instance.
- You can use the
GetStackInstancesubcommand to query detailed information about a specified stack instance, including its drift status and last drift detection time.