EventBridge Event JSON Object

EventBridge Event JSON Object

EventBridge is a serverless event bus service provided by AWS that allows you to create and manage events from various sources and consume them using targets such as AWS Lambda, Amazon SNS, Amazon SQS, and more. When an event is generated from a source, it's sent to the event bus where it's processed before reaching the target.

The event object in EventBridge is a JSON object that contains the details of the event. It consists of a header and a body. The header contains the metadata such as the source, time, and type of the event. The body contains the actual data of the event.


{
  "version": "0",
  "id": "12345678-1234-1234-1234-123456789012",
  "detail-type": "myEvent",
  "source": "myEventSource",
  "account": "111122223333",
  "time": "2022-05-22T15:14:34Z",
  "region": "us-east-1",
  "resources": [
    "arn:aws:events:us-east-1:111122223333:rule/myRule"
  ],
  "detail": {
    "key1": "value1",
    "key2": "value2",
    "key3": {
      "key4": "value4"
    }
  }
}
    

Here's a breakdown of each field in the event object:

  • version: The version of the event object. Always set to "0".
  • id: A unique identifier for the event.
  • detail-type: The type of the event, which is used to categorize events.
  • source: The source of the event, which is typically the name of the service or application that generated the event.
  • account: The AWS account ID where the event originated.
  • time: The time when the event was generated, in ISO 8601 format.
  • region: The AWS region where the event originated.
  • resources: An array of ARNs (Amazon Resource Names) that identify the resources that are associated with the event.
  • detail: A JSON object that contains the data of the event. It can be any valid JSON object.

Subscribe to The Poor Coder | Algorithm Solutions

Don’t miss out on the latest issues. Sign up now to get access to the library of members-only issues.
[email protected]
Subscribe