Amazon EventBridge events
An event indicates a change in an environment such as an Amazon environment, a SaaS partner service or application, or one of your applications or services. The following are examples of events:
-
Amazon EC2 generates an event when the state of an instance changes from pending to running.
-
Amazon EC2 Auto Scaling generates events when it launches or terminates instances.
-
Amazon CloudTrail publishes events when you make API calls.
You can also set up scheduled events that are generated on a periodic basis.
For a list of services that generate events, including sample events from each service, see Events from Amazon services and follow the links in the table.
Events are represented as JSON objects and they all have a similar structure, and the same top-level fields.
The contents of the detail top-level field are different depending on which service generated the event and what the event is. The combination of the source and detail-type fields serves to identify the fields and values found in the detail field. For examples of events generated by Amazon services, see Events from Amazon services.
Topics
The following video explains the basics of events:
The following video covers the ways events get to EventBridge:
The following fields appear in an event:
- version
-
By default, this is set to 0 (zero) in all events.
- id
-
A Version 4 UUID that's generated for every event. You can use
id
to trace events as they move through rules to targets. - detail-type
-
Identifies, in combination with the source field, the fields and values that appear in the detail field.
Events that are delivered by CloudTrail have
AWS API Call via CloudTrail
as the value fordetail-type
. - source
-
Identifies the service that generated the event. All events that come from Amazon services begin with "aws." Customer-generated events can have any value here, as long as it doesn't begin with "aws." We recommend the use of Java package-name style reverse domain-name strings.
To find the correct value for
source
for an Amazon service, see The condition keys table, select a service from the list, and look for the service prefix. For example, thesource
value for Amazon CloudFront isaws.cloudfront
. - account
-
The 12-digit number identifying an Amazon account.
- time
-
The event timestamp, which can be specified by the service originating the event. If the event spans a time interval, the service can report the start time, so this value might be before the time the event is received.
- region
-
Identifies the Amazon Region where the event originated.
- resources
-
A JSON array that contains ARNs that identify resources that are involved in the event. The service generating the event determines whether to include these ARNs. For example, Amazon EC2 instance state-changes include Amazon EC2 instance ARNs, Auto Scaling events include ARNs for both instances and Auto Scaling groups, but API calls with Amazon CloudTrail do not include resource ARNs.
- detail
-
A JSON object that contains information about the event. The service generating the event determines the content of this field. The detail content can be as simple as two fields. Amazon API call events have detail objects with approximately 50 fields nested several levels deep.
The following event in Amazon EventBridge indicates an Amazon EC2 instance being terminated.
{
"version": "0",
"id": "6a7e8feb-b491-4cf7-a9f1-bf3703467718",
"detail-type": "EC2 Instance State-change Notification",
"source": "aws.ec2",
"account": "111122223333",
"time": "2017-12-22T18:43:48Z",
"region": "us-west-1",
"resources": [
"arn:aws:ec2:us-west-1:123456789012:instance/i-1234567890abcdef0"
],
"detail": {
"instance-id": " i-1234567890abcdef0",
"state": "terminated"
}
}
Minimum information needed for a valid custom event
When you create custom events they must include the following fields:
detail
– A JSON object that contains information about the event. It can be"{}"
.Note PutEvents accepts data in JSON format. For the JSON number (integer) data type, the constraints are: a minimum value of -9,223,372,036,854,775,808 and a maximum value of 9,223,372,036,854,775,807.
detail-type
– A string that identifies the type of event.source
– A string that identifies the source of the event. Customer-generated events can have any value here, as long as it doesn't begin with "aws." We recommend the use of Java package-name style reverse domain-name strings.