偏差检测状态更改事件详细信息 - Amazon CloudFormation
Amazon Web Services 文档中描述的 Amazon Web Services 服务或功能可能因区域而异。要查看适用于中国区域的差异,请参阅 中国的 Amazon Web Services 服务入门 (PDF)

偏差检测状态更改事件详细信息

以下是堆栈偏差检测事件的详细信息字段。

之所以包含 sourcedetail-type 字段,是因为其包含 Amazon CloudFormation 事件的特定值。

{ . . ., "detail-type":"CloudFormation Drift Detection Status Change", "source":"aws.cloudformation", . . ., "detail":{ "stack-id":"string", "stack-drift-detection-id":"string", "status-details":{ "stack-drift-status":"string", "detection-status":"string" }, "drift-detection-details":{ "drifted-stack-resource-count":integer }, "client-request-token":"string" } }
detail-type

标识事件的类型。

对于堆栈偏差检测事件,此值为 CloudFormation Drift Detection Status Change

source

标识生成事件的服务。对于 CloudFormation 事件,此值为 aws.cloudformation

detail

包含关于事件信息的 JSON 对象。生成事件的服务决定该字段的内容。

对于堆栈偏差检测事件,这些数据包括:

stack-id

与堆栈关联的唯一堆栈 ID。

stack-drift-detection-id

堆栈偏差检测 ID。

status-details
stack-drift-status

堆栈的偏差状态。

detection-status

偏差检测操作的状态。

drift-detection-details
drifted-stack-resource-count

资源数量偏差。值为 -1 时,偏差检测正在进行。所有其他非负整数均表示偏差资源的实际数量。

client-request-token

用于调用 API 的访问令牌。由给定堆栈操作启动的所有事件分配的客户端请求令牌都是相同的,可使用此令牌跟踪操作。从控制台发起的堆栈操作使用令牌格式 Console-StackOperation-ID,这有助于您轻松识别堆栈操作。例如,如果使用控制台创建堆栈,则将向每个生成的堆栈事件分配以下格式的相同令牌:Console-CreateStack-7f59c3cf-00d2-40c7-b2ff-e75db0987002

例 示例:堆栈偏差检测事件

下面展示的是堆栈偏差检测事件的示例。此事件详细说明了 CloudFormation 已完成对指定堆栈的偏差检测,且因一个资源出现偏差,堆栈当前偏差状态为 DRIFTED

{ "version":"0", "id":"6a7e8feb-b491-4cf7-a9f1-bf3703467718", "detail-type":"CloudFormation Drift Detection Status Change", "source":"aws.cloudformation", "account":"111122223333", "time":"2017-12-22T18:43:48Z", "region":"us-west-1", "resources": ["string"], "detail":{ "stack-id":"arn:aws:cloudformation:us-west-1:111122223333:stack/teststack", "stack-drift-detection-id":"624af370-311a-11e8-b6b7-500cexample", "status-details":{ "stack-drift-status":"DRIFTED", "detection-status":"DETECTION_COMPLETE" }, "drift-detection-details":{ "drifted-stack-resource-count":1 }, "client-request-token":"" } }