您可以对资源栈上单个资源执行偏差检测操作,以便确定资源是否已偏离其预期的模板配置。
前提条件
检测偏差(控制台)
检测偏差(阿里云CLI)
使用aliyun ros DetectStackResourceDrift
在单个资源上检测偏差指定资源的逻辑ID,以及包含它的资源栈。
$ 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******"
}