You can call this operation to detect drift on a stack.


OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
Action String Yes DetectStackDrift

The operation that you want to perform. Set the value to DetectStackDrift.

RegionId String Yes cn-hangzhou

The region ID of the stack. You can call the DescribeRegions operation to query the most recent region list.

StackId String Yes 4a6c9851-3b0f-4f5f-b4ca-a14bf691****

The ID of the stack.

LogicalResourceId.N RepeatList No ScalingRule

The logical ID of resource N, which is used to filter resources.

ClientToken String No 123e4567-e89b-12d3-a456-42665544****

The client token that is used to ensure the idempotence of the request. You can use the client to generate the value, but you must ensure that it is unique among different requests.

The value can be up to 64 characters in length and can contain letters, digits, hyphens (-), and underscores (_).

For more information, see How to ensure idempotence.

Response parameters

Parameter Type Example Description
DriftDetectionId String a7044f0d-6f2e-4128-a307-4524ef88****

The ID of the drift detection.

RequestId String B288A0BE-D927-4888-B0F7-B35EF84B6E6

The ID of the request.


Sample requests

http(s):// Action=DetectStackDrift
&<Common request parameters>

Sample success responses

XML format


JSON format

    "DriftDetectionId": "a7044f0d-6f2e-4128-a307-4524ef88****",
    "RequestId": "B288A0BE-D927-4888-B0F7-B35EF84B6E6"

Error codes

For a list of error codes, visit the API Error Center.


Error code

Error message




The Stack ({name}) could not be found.

The error message returned because the specified stack does not exist. name indicates the name or ID of the stack.



The Resource ({name}) could not be found in Stack {stack}.

The error message returned because the specified resource does not exist in the specified stack. name indicates the resource name, and stack indicates the stack name or ID.



Stack {name} already has an action ({action}) in progress.

The error message returned because the specified stack has a change operation in progress. name indicates the name or ID of the stack, and action indicates the change operation.