

# 资源状态更改事件详细信息
<a name="event-detail-resource-status-change"></a>

以下是资源状态更改事件的详细信息字段。

之所以包含 `source` 和 `detail-type` 字段，是因为其包含事件的特定值。

```
{
  . . .,
  "detail-type": "CloudFormation Resource Status Change",
  "source": "aws.cloudformation",
  . . .,
  "detail": {
    "stack-id" : "string",
    "logical-resource-id" : "string",
    "physical-resource-id": "string",
    "status-details": {
        "status": "string",
        "status-reason": "string"
    },
     "resource-type": "string",
     "client-request-token": "string"
  }
}
```

`detail-type`  <a name="resource-status-change-detail-type"></a>
标识事件的类型。  
对于资源状态事件，此值为 `CloudFormation Resource Status Change`。

`source`  <a name="resource-status-change-source"></a>
标识生成事件的服务。对于 CloudFormation 事件，此值为 `aws.cloudformation`。

`detail`  <a name="resource-status-change-detail"></a>
包含关于事件信息的 JSON 对象。生成事件的服务决定该字段的内容。  
对于资源状态事件，这些数据包括：    
`stack-id`  <a name="resource-status-change-stack-id"></a>
与堆栈关联的唯一堆栈 ID。  
`logical-resource-id`  <a name="resource-status-change-logical-resource-id"></a>
资源的逻辑名称，如模板中所规定。  
`physical-resource-id`  <a name="resource-status-change-physical-resource-id"></a>
与 CloudFormation 所支持资源的物理实例 ID 对应的名称或唯一标识符。  
`status-details`  <a name="resource-status-change-status-details"></a>  
`status`  <a name="resource-status-change-status"></a>
资源的状态。  
`status-reason`  <a name="resource-status-change-status-reason"></a>
资源的状态原因。  
`resource-type`  <a name="resource-status-change-resource-type"></a>
资源的类型。例如 `AWS::S3::Bucket`。  
`client-request-token`  <a name="resource-status-change-client-request-token"></a>
用于调用 API 的访问令牌。由给定堆栈操作启动的所有事件分配的客户端请求令牌都是相同的，可使用此令牌跟踪操作。从控制台发起的堆栈操作使用令牌格式 *Console-StackOperation-ID*，这有助于您轻松识别堆栈操作。例如，如果使用控制台创建堆栈，则将向每个生成的堆栈事件分配以下格式的相同令牌：`Console-CreateStack-7f59c3cf-00d2-40c7-b2ff-e75db0987002`。

**Example 示例：资源状态更改事件**  <a name="event-detail-resource-status-change.example"></a>
以下是资源状态事件的示例。此事件详细说明了 CloudFormation 已在指定堆栈中成功创建所请求的资源，即 Amazon S3 存储桶。  

```
{
    "version":"0",
    "id":"6a7e8feb-b491-4cf7-a9f1-bf3703467718",
    "detail-type":"CloudFormation Resource Status Change",
    "source":"aws.cloudformation",
    "account":"111122223333",
    "time":"2017-12-22T18:43:48Z",
    "region":"us-west-1",
    "resources":[
        "arn:aws:cloudformation:us-west-1:111122223333:stack/teststack"
    ],
    "detail":{
        "stack-id":"arn:aws:cloudformation:us-west-1:111122223333:stack/teststack",
        "logical-resource-id":"my-s3-bucket",
        "physical-resource-id":"arn:aws:s3:::my-s3-bucket-us-east-1",
        "status-details":{
            "status":"CREATE_COMPLETE",
            "status-reason":""
        },
        "resource-type":"AWS::S3::Bucket",
        "client-request-token":""
    }
}
```