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


Make sure 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 of the stack that you want to manage.
  4. Click the Drifts tab.
  5. In the Resource Drift Status section, click Detect Resource Drift in the Actions column of the resource on which you want to detect drift.
  6. In the Resource Drift Status section, click View Drift Details in the Actions column of the resource. The physical ID, drift status, type, and last drift detection time of the resource are displayed.

Detect drift by using Alibaba Cloud CLI

You can use Alibaba Cloud CLI to call the DetectStackResourceDrift API operation to detect resource drift. You must specify the stack ID, resource name, and region ID of the stack.

Run the following command in Alibaba Cloud CLI:

aliyun ros DetectStackResourceDrift --StackId a4dffae5-d2a5-4188-b8b5-69dbe8a2**** --LogicalResourceId Vpc --RegionId cn-beijing

Expected output:

  "LogicalResourceId": "Vpc",
  "ResourceDriftStatus": "IN_SYNC",
  "RequestId": "7D9AAA7E-F165-5EB8-AFFA-B95A572B9921",
  "PhysicalResourceId": "vpc-2zevdu0ktm8tmzry9****",
  "ExpectedProperties": "{\"CidrBlock\": \"\", \"VpcName\": \"bff\"}",
  "DriftDetectionTime": "2021-10-20T06:13:01",
  "ResourceType": "ALIYUN::ECS::VPC",
  "ActualProperties": "{\"CidrBlock\": \"\", \"VpcName\": \"bff\"}",
  "StackId": "a4dffae5-d2a5-4188-b8b5-69dbe8a2****"