Queries the compliance evaluation results of resources monitored by a compliance package.

In this topic, the cp-541e626622af0087**** compliance package is used as an example. The return result shows a total of 10 resources and seven of them are evaluated as non-compliant.


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 GetResourceComplianceByPack

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

CompliancePackId String Yes cp-541e626622af0087****

The ID of the compliance package.

For more information about how to obtain the ID of a compliance package, see ListCompliancePacks.

For information about common request parameters, see Common parameters.

Response parameters

Parameter Type Example Description
ResourceComplianceResult Object

The compliance evaluation results returned.

CompliancePackId String cp-541e626622af0087****

The ID of the compliance package.

NonCompliantCount Integer 7

The number of non-compliant resources.

TotalCount Integer 10

The total number of resources.

RequestId String 6EC7AED1-172F-42AE-9C12-295BC2ADB751

The ID of the request.


Sample requests

&<Common request parameters>

Sample success responses

XML format

HTTP/1.1 200 OK


JSON format

HTTP/1.1 200 OK

  "ResourceComplianceResult" : {
    "CompliancePackId" : "cp-541e626622af0087****",
    "NonCompliantCount" : 7,
    "TotalCount" : 10
  "RequestId" : "6EC7AED1-172F-42AE-9C12-295BC2ADB751"

Error codes

HTTP status code Error code Error message Description
400 Invalid.CompliancePackId.Value The specified CompliancePackId does not exist. The error message returned because the specified compliance package ID does not exist.
404 AccountNotExisted Your account does not exist. The error message returned because your account does not exist.
503 ServiceUnavailable The request has failed due to a temporary failure of the server. The error message returned because the service is unavailable.

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