

# Monitoring CloudFormation and Git sync events with EventBridge
<a name="eventbridge-integration"></a>

Amazon EventBridge is a serverless service that uses events to connect application components together, making it easier for you to build scalable event-driven applications. Event-driven architecture is a style of building loosely-coupled software systems that work together by emitting and responding to events. Events represent a change in a resource or environment. 

As with many AWS services, CloudFormation generates and sends events to the EventBridge default event bus, which is automatically provisioned in every AWS account. An event bus is a router that receives events and delivers them to zero or more destinations, or *targets*. Rules you specify for the event bus evaluate events as they arrive. Each rule checks whether an event matches the rule's *event pattern*. If the event does match, the event bus sends the event to the specified target(s).

For more information, see [Getting started with Amazon EventBridge](https://docs.aws.amazon.com/eventbridge/latest/userguide/eb-get-started.html) in the *Amazon EventBridge User Guide*.

![\[AWS services send events to the EventBridge default event bus. If the event matches a rule's event pattern, EventBridge sends the event to the targets specified for that rule.\]](http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/images/eventbridge-integration-how-it-works.png)


**Topics**
+ [CloudFormation and Git sync events overview](#supported-events)
+ [Amazon EventBridge permissions](#eventbridge-permissions)
+ [Creating a custom event pattern for an EventBridge rule](eventbridge-using-events-rules-patterns.md)
+ [CloudFormation events detail reference](events-detail-reference.md)

## CloudFormation and Git sync events overview
<a name="supported-events"></a>

CloudFormation sends events to EventBridge whenever a create, update, delete, or drift-detection operation is performed on a stack. CloudFormation also sends events to EventBridge for status changes to stack sets and stack set instances. You can use EventBridge rules to route events to your defined targets. These events are guaranteed to be delivered, and they might be delivered out of order.

Since CloudFormation events represent changes to stacks or stack sets and their resources, you can use them to initiate workflows associated with respective events. For example:
+ Create stack or stack set specific tags on all resource provisioned through CloudFormation.
+ Establish an association between a CloudFormation stack or stack set and an Amazon WorkSpaces Application Manager (Amazon WAM).
+ Specify an association with an AppRegistry for the created stack or stack set.

The following events are generated by CloudFormation and sent to the default event bus in EventBridge. For more information, see [CloudFormation events detail reference](events-detail-reference.md).


| Event type | Description | Event source | 
| --- | --- | --- | 
|  [Resource Status Change](event-detail-resource-status-change.md)  |  Any updates performed on a stack which changes underlying resource properties.  For a complete list of supported AWS resource types, see the [AWS resource and property types reference](https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/aws-template-resource-type-ref.html).  | AWS CloudFormation | 
|  [Stack Status Change](event-detail-stack-status-change.md)  |  Represents a status change to a given stack.  For code details, see [Stack status codes](view-stack-events.md#cfn-console-view-stack-data-resources-status-codes).  | AWS CloudFormation | 
|  [Drift Detection Status Change](event-detail-stack-drift-detection-change.md)  |  Represents a user-initiated drift detection update on a given stack.  For a complete list of fully mutable and immutable types that support drift detection, see [Resource type support](resource-import-supported-resources.md)  | AWS CloudFormation | 
|  [StackSet Status Change](event-detail-stackset-status-change.md)  |  Represents a status change to a given stack set.  | AWS CloudFormation | 
|  [StackSet Stack Instance Status Change](event-detail-stackset-stack-instance-status-change.md)  |  Represents a status change to a specific StackSet stack instance. For code details, see [Stack instance status codes](stacksets-concepts.md#stack-instance-status-codes).  | AWS CloudFormation | 
|  [StackSet operation status](event-detail-stackset-operation-status-change.md)  |  Represents a status change to a given StackSet operation. For code details, see [StackSets status codes](stacksets-concepts.md#stackset-status-codes).  | AWS CloudFormation | 

Additionally, AWS CloudFormation Git sync sends events for status changes for repository syncs and resource syncs to EventBridge.

The following Git sync events are generated by CodeConnections and sent to the default event bus in EventBridge. For more information, see [CloudFormation events detail reference](events-detail-reference.md).


| Event type | Description | Event source | 
| --- | --- | --- | 
|  [Repository sync status change](event-detail-respository-sync-status-change.md)  |  Represents a status change to a Git repository sync.  | AWS CodeConnections | 
|  [Resource sync status change](event-detail-resource-sync-status-change.md)  |  Represents a status change to a Git resource sync.  | AWS CodeConnections | 

## Amazon EventBridge permissions
<a name="eventbridge-permissions"></a>

CloudFormation doesn't require any additional permissions to deliver events to EventBridge. The events contain information that's already available through CloudFormation's API operations.

The targets you specify may need specific permissions or configuration. For more details on using specific services for targets, see [Amazon EventBridge targets](https://docs.aws.amazon.com/eventbridge/latest/userguide/eb-targets.html) in the *Amazon EventBridge User Guide*.

# Creating a custom event pattern for an EventBridge rule
<a name="eventbridge-using-events-rules-patterns"></a>

You can find several predefined patterns in EventBridge for CloudFormation and Git sync events. This simplifies how an event pattern is created. Instead of writing your own event patterns, you can select field values on a form, and EventBridge generates the pattern for you. You can create a new rule using one of these predefined event patterns or create your own custom event pattern.

When a service like CloudFormation delivers an event to the default event bus, EventBridge uses the event pattern defined in your rule to determine if the event should be delivered to the rule's target(s). An event pattern matches the data in the desired CloudFormation events. 

Each event pattern is a JSON object that contains:
+ A `source` attribute that identifies the service the event is coming from. For example, `aws.cloudformation` or `aws.codeconnections`. 
+ (Optional): A `detail-type` attribute that contains an array of the event types to match.
+ (Optional): A `detail` attribute containing any other event data on which to match.

  For example, the stack ID, the resources involved, status of various resources, and other data relevant to a particular type of events.

For example, the following event pattern matches against all resource status change events:

```
{
  "source": ["aws.cloudformation"],
  "detail-type": ["CloudFormation Resource Status Change"]
}
```

While the following event pattern uses event detail data to match only resource status change events where CloudFormation creates a new `AWS::S3::Bucket` or `AWS::SNS::Topic` resource:

```
{
  "source": ["aws.cloudformation"],
  "detail-type": ["CloudFormation Resource Status Change"],
  "detail": {
    "status-details": {
      "status": ["CREATE_COMPLETE"]
    },
    "resource-type": ["AWS::S3::Bucket", "AWS::SNS::Topic"]
  }
}
```

For more information on writing event patterns, see [Event patterns](https://docs.aws.amazon.com/eventbridge/latest/userguide/eb-event-patterns.html) in the *Amazon EventBridge User Guide*.

# CloudFormation events detail reference
<a name="events-detail-reference"></a>

All events from AWS services have a common set of fields containing metadata about the event, such as the AWS service that's the source of the event, the time the event was generated, the account and region in which the event took place, and others. For definitions of these general fields, see [AWS service event metadata](https://docs.aws.amazon.com/eventbridge/latest/ref/events-structure.html) in the *AWS Events Reference*. 

In addition, each event has a `detail` field that contains data specific to that particular event. The reference below defines the detail fields for the various CloudFormation events.

When using EventBridge to select and manage CloudFormation events, it's useful to keep the following in mind:
+ The `source` field specifies the event source.

  For example, `aws.cloudformation` or `aws.codeconnections`. 
+ The `detail-type` field specifies the event type. 

  For example, `CloudFormation Resource Status Change` or `CloudFormation Drift Detection Status Change`.
+ The `detail` field contains the data that is specific to that particular event. 

  For example, the stack ID, the resources involved, status of various resources, and other data relevant to a particular type of events.

For information on constructing event patterns that enable rules to match CloudFormation events, see [Event patterns](https://docs.aws.amazon.com/eventbridge/latest/userguide/eb-event-patterns.html) in the *Amazon EventBridge User Guide*.

For more information on events and how EventBridge processes them, see [EventBridge events](https://docs.aws.amazon.com/eventbridge/latest/userguide/eb-events.html) in the *Amazon EventBridge User Guide*.

**Topics**
+ [Resource Status Change event detail](event-detail-resource-status-change.md)
+ [Stack Status Change event detail](event-detail-stack-status-change.md)
+ [Drift Detection Status Change event detail](event-detail-stack-drift-detection-change.md)
+ [StackSet Status Change event detail](event-detail-stackset-status-change.md)
+ [StackSet Stack Instance Status Change event detail](event-detail-stackset-stack-instance-status-change.md)
+ [StackSet Operation Status Change event detail](event-detail-stackset-operation-status-change.md)
+ [Repository Sync Status Change event detail](event-detail-respository-sync-status-change.md)
+ [Resource Sync Status Change event detail](event-detail-resource-sync-status-change.md)

# Resource Status Change event detail
<a name="event-detail-resource-status-change"></a>

Below are the detail fields for Resource Status Change events.

The `source` and `detail-type` fields are included because they contain specific values for events.

```
{
  . . .,
  "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>
Identifies the type of event.  
For resource status events, this value is `CloudFormation Resource Status Change`.

`source`  <a name="resource-status-change-source"></a>
Identifies the service that generated the event. For CloudFormation events, this value is `aws.cloudformation`.

`detail`  <a name="resource-status-change-detail"></a>
A JSON object that contains information about the event. The service generating the event determines the content of this field.  
For resource status events, this data includes:    
`stack-id`  <a name="resource-status-change-stack-id"></a>
The unique stack ID that's associated with the stack.  
`logical-resource-id`  <a name="resource-status-change-logical-resource-id"></a>
The logical name of the resource as specified in the template.  
`physical-resource-id`  <a name="resource-status-change-physical-resource-id"></a>
The name or unique identifier that corresponds to a physical instance ID of a resource supported by CloudFormation.  
`status-details`  <a name="resource-status-change-status-details"></a>  
`status`  <a name="resource-status-change-status"></a>
Status of the resource.  
`status-reason`  <a name="resource-status-change-status-reason"></a>
Status reason of the resource.  
`resource-type`  <a name="resource-status-change-resource-type"></a>
Type of resource. For example, `AWS::S3::Bucket`.  
`client-request-token`  <a name="resource-status-change-client-request-token"></a>
An access token used to call the API. All events that are initiated by a given stack operation are assigned the same client request token, which you can use to track operations. Stack operations that are initiated from the console use the token format *Console-StackOperation-ID*, which helps you to easily identify the stack operation. For example, if you create a stack using the console, each resulting stack event would be assigned the same token in the following format: `Console-CreateStack-7f59c3cf-00d2-40c7-b2ff-e75db0987002`.

**Example: Resource Status Change event**  <a name="event-detail-resource-status-change.example"></a>
The following is an example resource status event. This event details that CloudFormation has successfully created the requested resource, an Amazon S3 bucket, in the specified stack.  

```
{
    "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":""
    }
}
```

# Stack Status Change event detail
<a name="event-detail-stack-status-change"></a>

Below are the detail fields for Stack Status Change events.

The `source` and `detail-type` fields are included because they contain specific values for events.

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

`detail-type`  <a name="stack-status-change-detail-type"></a>
Identifies the type of event.  
For stack status events, this value is `CloudFormation Stack Status Change`.

`source`  <a name="stack-status-change-source"></a>
Identifies the service that generated the event. For CloudFormation events, this value is `aws.cloudformation`.

`detail`  <a name="stack-status-change-detail"></a>
A JSON object that contains information about the event. The service generating the event determines the content of this field.  
For stack status events, this data includes:    
`stack-id`  <a name="stack-status-change-stack-id"></a>
The unique stack ID associated with the stack.  
`status-details`  <a name="stack-status-change-status-details"></a>  
`status`  <a name="stack-status-change-status"></a>
Status of the stack.  
For a complete list of stack status codes, see [Stack status codes](view-stack-events.md#cfn-console-view-stack-data-resources-status-codes).  
`status-reason`  <a name="stack-status-change-status-reason"></a>
Status reason of the resource.  
`client-request-token`  <a name="stack-status-change-client-request-token"></a>
An access token used to call the API. All events that are initiated by a given stack operation are assigned the same client request token, which you can use to track operations. Stack operations that are initiated from the console use the token format *Console-StackOperation-ID*, which helps you to easily identify the stack operation. For example, if you create a stack using the console, each resulting stack event would be assigned the same token in the following format: `Console-CreateStack-7f59c3cf-00d2-40c7-b2ff-e75db0987002`.

**Example: Stack Status event**  <a name="event-detail-stack-status-change.example"></a>
The following is an example stack status event, where CloudFormation has successfully created the requested stack, `teststack`.  

```
{
    "version":"0",
    "id":"6a7e8feb-b491-4cf7-a9f1-bf3703467718",
    "detail-type":"CloudFormation Stack 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",
        "status-details":{
            "status":"CREATE_COMPLETE",
            "status-reason":""
        },
        "client-request-token":""
    }
}
```

# Drift Detection Status Change event detail
<a name="event-detail-stack-drift-detection-change"></a>

Below are the detail fields for stack drift detection events.

The `source` and `detail-type` fields are included because they contain specific values for events.

```
{
  . . .,
  "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`  <a name="drift-detection-status-change-detail-type"></a>
Identifies the type of event.  
For stack drift detection events, this value is `CloudFormation Drift Detection Status Change`.

`source`  <a name="drift-detection-status-change-source"></a>
Identifies the service that generated the event. For CloudFormation events, this value is `aws.cloudformation`.

`detail`  <a name="drift-detection-status-change-detail"></a>
A JSON object that contains information about the event. The service generating the event determines the content of this field.  
For stack drift detection events, this data includes:    
`stack-id`  <a name="drift-detection-status-change-stack-id"></a>
The unique stack ID that's associated with the stack.  
`stack-drift-detection-id`  <a name="drift-detection-status-change-stack-drift-detection-id"></a>
The stack drift detection Id.  
`status-details`  <a name="drift-detection-status-change-status-details"></a>  
`stack-drift-status`  <a name="drift-detection-status-change-stack-drift-status"></a>
Drift status of the stack.  
`detection-status`  <a name="drift-detection-status-change-detection-status"></a>
Status of drift detection operation.  
`drift-detection-details`  <a name="drift-detection-status-change-drift-detection-details"></a>  
`drifted-stack-resource-count`  <a name="drift-detection-status-change-drifted-stack-resource-count"></a>
Number of resources drifted. When the value is `-1`, the drift detection is in progress. All other non--negative integers represent the actual number of drifted resources.  
`client-request-token`  <a name="drift-detection-status-change-client-request-token"></a>
An access token used to call the API. All events that are initiated by a given stack operation are assigned the same client request token, which you can use to track operations. Stack operations that are initiated from the console use the token format *Console-StackOperation-ID*, which helps you to easily identify the stack operation. For example, if you create a stack using the console, each resulting stack event would be assigned the same token in the following format: `Console-CreateStack-7f59c3cf-00d2-40c7-b2ff-e75db0987002`.

**Example: Stack Drift Detection event**  <a name="event-detail-stack-drift-detection-change.example"></a>
The following is an example Stack Drift Detection event. This event details that CloudFormation has completed drift detection on the specified stack, and that the stack currently has a drift status of `DRIFTED` due to one drifted resource.  

```
{
    "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":""
    }
}
```

# StackSet Status Change event detail
<a name="event-detail-stackset-status-change"></a>

Below are the detail fields for StackSet Status Change events.

The `source` and `detail-type` fields are included because they contain specific values for events.

```
{
  . . .,
  "detail-type": "CloudFormation StackSet Status Change",
  "source": "aws.cloudformation",
  . . .,
  "detail": {
    "stack-set-arn" : "string",
    "status-details": {
        "status":"string"
    }
  }
}
```

`detail-type`  <a name="stackset-status-change-detail-type"></a>
Identifies the type of event.  
For StackSet status event events, this value is `CloudFormation StackSet Status Change`.

`source`  <a name="stackset-status-change-source"></a>
Identifies the service that generated the event. For CloudFormation events, this value is `aws.cloudformation`.

`detail`  <a name="stackset-status-change-detail"></a>
A JSON object that contains information about the event. The service generating the event determines the content of this field.  
For StackSet status event events, this data includes:    
`stack-set-arn`  <a name="stackset-status-change-stack-set-arn"></a>
The Amazon Resource Name (ARN) associated with the stack set.  
`status-details`  <a name="stackset-status-change-status-details"></a>  
`status`  <a name="stackset-status-change-status"></a>
The StackSet status.   
*Valid values*: `ACTIVE` \$1 `DELETED`

**Example: StackSet Status Change event**  <a name="event-detail-stackset-status-change.example"></a>
The following is an example StackSet Status Change event. This event details that CloudFormation has deleted the specified stack set.  

```
{
  "version": "0",
  "id": "42h6hb90-hg0w-11op-b01v-0xhnh0934z09",
  "detail-type": "CloudFormation StackSet Status Change",
  "source": "aws.cloudformation",
  "account": "111122223333",
  "time": "2021-09-23T17:06:18Z",
  "region": "us-east-1",
  "resources": [
    "arn:aws:cloudformation:us-east-1:111122223333:stackset/test12345:3f3a3fbe-c937-4eb3-a87d-e36a0af3f663"
  ],
  "detail": {
    "stack-set-arn" : "arn:aws:cloudformation:us-east-1:111122223333:stackset/test12345:3f3a3fbe-c937-4eb3-a87d-e36a0af3f663",
    "status-details": {
        "status":"DELETED"
    }
  }
}
```

# StackSet Stack Instance Status Change event detail
<a name="event-detail-stackset-stack-instance-status-change"></a>

Below are the detail fields for StackSet stack instance status events.

The `source` and `detail-type` fields are included because they contain specific values for events.

```
{
  . . .,
  "detail-type": "CloudFormation StackSet StackInstance Status Change",
  "source": "aws.cloudformation",
  . . .,
  "detail": {
    "stack-set-arn" : "string",
    "stack-id" : "string",
    "action" : "string",       
    "status-details": {
        "status": "string",
        "status-reason": "string",
        "detailed-status": "string"
      }
    }
  }
}
```

`detail-type`  <a name="stackset-stack-instance-status-detail-type"></a>
Identifies the type of event.  
For StackSet stack instance status events, this value is `CloudFormation StackSet StackInstance Status Change`.

`source`  <a name="stackset-stack-instance-status-source"></a>
Identifies the service that generated the event. For CloudFormation events, this value is `aws.cloudformation`.

`detail`  <a name="stackset-stack-instance-status-detail"></a>
A JSON object that contains information about the event. The service generating the event determines the content of this field.  
For StackSet stack instance status events, this data includes:    
`stack-set-arn`  <a name="stackset-stack-instance-status-stack-set-arn"></a>
The Amazon Resource Name (ARN) associated with the StackSet.  
`stack-id`  <a name="stackset-stack-instance-status-stack-id"></a>
The unique stack ID that's associated with the stack instance.  
`action`  <a name="stackset-stack-instance-status-action"></a>
The type of stack set operation.  
*Valid values*: `CREATE` \$1 `UPDATE`\$1 `DELETE` \$1 `DETECT_DRIFT`  
`status-details`  <a name="stackset-stack-instance-status-status-details"></a>  
`status`  <a name="stackset-stack-instance-status-status"></a>
The StackSet instance status.  
For more details, see [Stack instance status codes](stacksets-concepts.md#stack-instance-status-codes).  
*Valid values*: `CURRENT` \$1 `OUTDATED`\$1 `INOPERABLE`  
`status-reason`  <a name="stackset-stack-instance-status-status-reason"></a>
Status reason of the StackSet instance.  
`detailed-status`  <a name="stackset-stack-instance-status-detailed-status"></a>
The detailed StackSet instance detailed status.  
*Valid values*: `CANCELLED` \$1 `FAILED` \$1 `FAILED_IMPORT` \$1 `INOPERABLE` \$1 `PENDING` \$1 `RUNNING` \$1 `SKIPPED_SUSPENDED_ACCOUNT` \$1 `SUCCEEDED`

**Example: StackSet Stack Instance Status Change event**  <a name="event-detail-stackset-stack-instance-status-change.example"></a>
The following is an example StackSet Stack Instance Status Change event.   

```
{
  "version": "0",
  "id": "42h6hb90-hg0w-11op-b01v-0xhnh0934z09",
  "detail-type": "CloudFormation StackSet StackInstance Status Change",
  "source": "aws.cloudformation",
  "account": "111122223333",
  "time": "2021-09-22T19:19:23Z",
  "region": "us-east-1",
  "resources": [
    "arn:aws:cloudformation:us-east-1:111122223333:stackset/test1234:e5f54eea-d041-44ad-94f8-b8268aca1e59"
  ],
  "detail": {
     "stack-set-arn": "arn:aws:cloudformation:us-east-1:111122223333:stackset/test1234:e5f54eea-d041-44ad-94f8-b8268aca1e59",
    "stack-id": "arn:aws:cloudformation:us-west-1:111122223333:stack/teststack",
    "status-details": {
        "status": "OUTDATED",
        "status-reason": "User Initiated",
        "detailed-status": "PENDING"
    }
  }
}
```

# StackSet Operation Status Change event detail
<a name="event-detail-stackset-operation-status-change"></a>

Below are the detail fields for StackSet Operation Status Change events.

The `source` and `detail-type` fields are included because they contain specific values for events.

```
{
  . . .,
  "detail-type": "CloudFormation StackSet Operation Status Change",
  "source": "aws.cloudformation",
  . . .,
  "detail": {
    "stack-set-arn" : "string",
    "stack-set-operation-id" : "string",
    "status-details": {
        "status": "string"
      }
    }
  }
}
```

`detail-type`  <a name="stackset-operation-status-change-detail-type"></a>
Identifies the type of event.  
For StackSet operation status events, this value is `CloudFormation StackSet Operation Status Change`.

`source`  <a name="stackset-operation-status-change-source"></a>
Identifies the service that generated the event. For CloudFormation events, this value is `aws.cloudformation`.

`detail`  <a name="stackset-operation-status-change-detail"></a>
A JSON object that contains information about the event. The service generating the event determines the content of this field.  
For StackSet operation status events, this data includes:    
`stack-set-arn`  <a name="stackset-operation-status-change-stack-set-arn"></a>
The Amazon Resource Name (ARN) associated with the StackSet.  
`stack-set-operation-id`  <a name="stackset-operation-status-change-stack-set-operation-id"></a>
The unique ID that's associated with the StackSet operation.  
`status-details`  <a name="stackset-operation-status-change-status-details"></a>  
`status`  <a name="stackset-operation-status-change-status"></a>
The StackSet operation status.  
For more details, see [StackSets status codes](stacksets-concepts.md#stackset-status-codes).  
*Valid values*: `RUNNING` \$1 `SUCCEEDED` \$1 `FAILED` \$1 `STOPPING` \$1 `STOPPED` \$1 `QUEUED`

**Example: StackSet Operation Status Change event**  <a name="event-detail-stackset-operation-status-change.example"></a>
The following is an example StackSet Operation Status Change event. The event details that CloudFormation has successfully completed the requested operation on the specified stack set.  

```
{
  "version": "0",
  "id": "4de89905-fd92-6a6b-9509-23c04bcb6a21",
  "detail-type": "CloudFormation StackSet Operation Status Change",
  "source": "aws.cloudformation",
  "account": "111122223333",
  "time": "2021-09-22T05:46:24Z",
  "region": "us-east-1",
  "resources": [
    "arn:aws:cloudformation:us-east-1:111122223333:stackset/test1234:e5f54eea-d041-44ad-94f8-b8268aca1e59"
  ],
  "detail": {
    "stack-set-arn": "arn:aws:cloudformation:us-east-1:111122223333:stackset/test1234:e5f54eea-d041-44ad-94f8-b8268aca1e59",
    "stack-set-operation-id": "ce69adce-2221-4483-8c4b-c51f284f25e8",
    "status-details": {
        "status": "SUCCEEDED"
    }
  }
}
```

# Repository Sync Status Change event detail
<a name="event-detail-respository-sync-status-change"></a>

Below are the detail fields for Repository Sync Status Change events.

The `source` and `detail-type` fields are included because they contain specific values for events.

```
{
  . . .,
  "detail-type": "Git Sync Repository Sync Status Change",
  "source": "aws.codeconnections",
  . . .,
  "detail": {
    "connectionArn" : "string",
    "providerType" : "string",
    "repositoryName": "string",
    "providerType": "string",
    "repositoryName": "string",
    "repositoryArn": "string",
    "repositoryLinkId": "string",
    "ownerId": "string",
    "commit": "string",
    "branch": "string",
    "syncType": "string",
    "status": "string",
    "previousSync": "string"
    }
  }
}
```

`detail-type`  <a name="respository-sync-status-change-detail-type"></a>
Identifies the type of event.  
For Repository Sync status events, this value is `Git Sync Repository Sync Status Change`.

`source`  <a name="respository-sync-status-change-source"></a>
Identifies the service that generated the event. For Git sync events, this value is `aws.codeconnections`.

`detail`  <a name="respository-sync-status-change-detail"></a>
A JSON object that contains information about the event. The service generating the event determines the content of this field.  
For Repository sync status events, this data includes:    
`connectionArn`  <a name="respository-sync-status-change-connection-arn"></a>
The Amazon Resource Name (ARN) associated with CodeConnections.  
`providerType`  <a name="respository-sync-status-change-provider-type"></a>
The Git provider connected to CloudFormation.  
*Valid values*: `GitHub` \$1 `GitHub Enterprise` \$1 `GitLab` \$1 `BitBucket`  
`repositoryName`  <a name="respository-sync-status-change-repository-name"></a>
The Git repository name.  
`repositoryArn`  <a name="respository-sync-status-change-repository-arn"></a>
The ARN associated with the Git repository.  
`repositoryLinkId`  <a name="respository-sync-status-change-repository-link-id"></a>
The unique ID associated with repository link.  
`ownerId`  <a name="respository-sync-status-change-owner-id"></a>
The unique ID associated with repository owner.  
`commit`  <a name="respository-sync-status-change-commit"></a>
The unique ID associated with the repository commit.  
`branch`  <a name="respository-sync-status-change-branch"></a>
The unique ID associated with the repository branch.  
`syncType`  <a name="respository-sync-status-change-sync-type"></a>
The type of sync being performed.  
`status`  <a name="respository-sync-status-change-status"></a>
The current repository sync status.  
*Valid values*: `FAILED` \$1 `INITIATED` \$1 `IN_PROGRESS` \$1 `SUCCEEDED`  
`previousSync`  <a name="respository-sync-status-change-previous-sync"></a>
The sync status previous to the current status.  
*Valid values*: `FAILED` \$1 `INITIATED` \$1 `IN_PROGRESS` \$1 `SUCCEEDED`

**Example: Repository Sync Status Change event**  <a name="event-detail-respository-sync-status-change.example"></a>
The following is an example Repository Sync Status Change event. The event details that CodeConnections has successfully synchronized the repository.  

```
{
  "version": "0",
  "id": "1b5d8feb-agbv-4cf7-a9f1-bf3703467718",
  "detail-type": "GitSync Repository Sync Status Change",
  "source": "aws.codeconnections",
  "account": "111122223333",
  "time": "2023-12-22T18:43:48Z",
  "region": "us-east-1",
  "resources": ["arn:aws:aws:codestar-connections:us-east-1:111122223333:repository-link/550e8400-e29b-41d4-a716-446655440000",],
  "detail": {
    "connectionArn": "arn:aws:codestar-connections:us-east-1:111122223333:connection/sample-connection-id",
    "providerType": "GitHub",
    "repositoryName": "sample-repository-name",
    "repositoryArn": "arn:aws:aws:codestar-connections:us-east-1:111122223333:repository-link/550e8400-e29b-41d4-a716-446655440000"
    "repositoryLinkId": "550e8400-e29b-41d4-a716-446655440000"
    "ownerId": "sample-owner-id",
    "commit": "sample-commit-id",
    "branch": "main",
    "syncType": "CFN_STACK_SYNC",
    "status": "SUCCEEDED",
    "previousStatus": "IN_PROGRESS",
  }
}
```

# Resource Sync Status Change event detail
<a name="event-detail-resource-sync-status-change"></a>

Below are the detail fields for Resource Sync Status Change events.

The `source` and `detail-type` fields are included because they contain specific values for events.

```
{
  . . .,
  "detail-type": "Git Sync Resource Sync Status Change",
  "source": "aws.codeconnections",
  . . .,
  "detail": {
    "providerType" : "string",
    "commit" : "string",
    "repositoryName": "string",
    "branch": "string",
    "syncType": "string",
    "syncTarget": "string",
    "status": "string",
    "previousSync": "string"
  }
}
```

`detail-type`  <a name="resource-sync-status-change-detail-type"></a>
Identifies the type of event.  
For Repository Sync status events, this value is `Git Sync Repository Sync Status Change`.

`source`  <a name="resource-sync-status-change-source"></a>
Identifies the service that generated the event. For Git sync events, this value is `aws.codeconnections`.

`detail`  <a name="resource-sync-status-change-detail"></a>
A JSON object that contains information about the event. The service generating the event determines the content of this field.  
For resource sync status events, this data includes:    
`providerType`  <a name="resource-sync-status-change-provider-type"></a>
The Git provider connected to CloudFormation.  
*Valid values*: `GitHub` \$1 `GitHub Enterprise` \$1 `GitLab` \$1 `BitBucket`  
`commit`  <a name="resource-sync-status-change-commit"></a>
The unique ID associated with the repository commit.  
`repositoryName`  <a name="resource-sync-status-change-repository-name"></a>
The Git repository name.  
`branch`  <a name="resource-sync-status-change-branch"></a>
The unique ID associated with the repository branch.  
`syncType`  <a name="resource-sync-status-change-sync-type"></a>
The type of sync being performed.  
`syncTarget`  <a name="resource-sync-status-change-sync-target"></a>
The target stack for the resource sync.  
`status`  <a name="resource-sync-status-change-status"></a>
The current repository sync status.  
*Valid values*: `FAILED` \$1 `INITIATED` \$1 `IN_PROGRESS` \$1 `SUCCEEDED`  
`previousSync`  <a name="resource-sync-status-change-previous-sync"></a>
The sync status previous to the current status.  
*Valid values*: `FAILED` \$1 `INITIATED` \$1 `IN_PROGRESS` \$1 `SUCCEEDED`

**Example: Resource Sync Status Change event**  <a name="event-detail-resource-sync-status-change.example"></a>
The following is an example resource sync status change event. The event details that CodeConnections has successfully synchronized the resource.  

```
{
  "version": "0",
  "id": "1b5d8feb-agbv-4cf7-a9f1-bf3703467718",
  "detail-type": "Git Sync Resource Sync Status Change",
  "source": "aws.codeconnections",
  "account": "111122223333",
  "time": "2023-12-22T18:43:48Z",
  "region": "us-east-1",
  "resources": ["arn:aws:aws:cloudformation:us-east-1:111122223333:stack/targetStack1"],
  "detail": {
    "providerType": "GitHub",
    "commit": "sample-commit-id",
    "repositoryName": "sample-repository-name",
    "branch": "main",
    "syncType": "CFN_STACK_SYNC",
    "syncTarget": "arn:aws:aws:cloudformation:us-east-1:111122223333:stack/targetStack1",
    "status": "SUCCEEDED",
    "previousStatus": "IN_PROGRESS"
  }
}
```