You can perform drift detection on a resource in a stack to determine whether the resource has drifted from its expected configurations.

Prerequisites

A drift detection operation is performed on the entire stack. For more information, see Detect drift on a stack.

Detect drift 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, click the ID under the stack name.
  4. Click the Drifts tab.
  5. In the Resource Drift Status section, click Detect Resource Drift in the Actions column corresponding to the resource on which you want to detect drift.
    检测资源偏差
  6. In the Resource Drift Status section, click View Drift Details in the Actions column corresponding to the resource. The physical ID, drift status, type, and last drift detection time of the resource are displayed.
    查看偏差

Detect drift through Alibaba Cloud CLI

You can use the aliyun ros DetectStackResourceDrift command through Alibaba Cloud Command Line Interface (Alibaba Cloud CLI) to detect drift on a resource, and view the logical resource ID and the stack to which the resource belongs.

$ aliyun ros DetectStackResourceDrift --StackId 4334b961-3bfd-419e-9a00-23a95e****** --LogicalResourceId Vpc1
{
    "ResourceDriftStatus": "MODIFIED",
    "LogicalResourceId": "Vpc1",
    "PropertyDifferences": [
        {
            "ActualValue": "test11",
            "PropertyPath": "/Description",
            "ExpectedValue": "test1",
            "DifferenceType": "NOT_EQUAL"
        }
    ],
    "RequestId": "A488767B-7440-4A74-81FD-BCF91A2EE1BB",
    "PhysicalResourceId": "vpc-m5euqfvmzygb7xq******",
    "ExpectedProperties": "{\"CidrBlock\": \"192.168.0.0/16\", \"Description\": \"test1\", \"VpcName\": \"test1\"}",
    "DriftDetectionTime": "2020-03-17T08:35:34",
    "ResourceType": "ALIYUN::ECS::VPC",
    "ActualProperties": "{\"CidrBlock\": \"192.168.0.0/16\", \"Description\": \"test11\", \"VpcName\": \"test1\"}",
    "StackId": "4334b961-3bfd-419e-9a00-23a95e******"
}