Transform EventBridge Events to CloudEvents using Input Transformer, incl. projecting AWS Region and Account ID from the EventBridge event to CloudEvent extended attributes.
Note
You can test whether the transformed CloudEvent is valid using this simple CloudEvent validator utility.
Note
Example from https://github.com/awslabs/eventbridge-kafka-connector
{
"version": "0",
"id": "dbc1c73a-c51d-0c0e-ca61-ab9278974c57",
"account": "1234567890",
"time": "2023-05-23T11:38:46Z",
"region": "us-east-1",
"detail-type": "kafka-connect-json-values-topic",
"source": "kafka-connect.my-json-values-connector",
"resources": [],
"detail": {
"topic": "json-values-topic",
"partition": 0,
"offset": 0,
"timestamp": 1684841916831,
"timestampType": "CreateTime",
"headers": [],
"key": "order-1",
"value": {
"orderItems": [
"item-1",
"item-2"
],
"orderCreatedTime": "Tue May 23 13:38:46 CEST 2023"
}
}
}
{
"data": "$.detail",
"id": "$.id",
"source": "$.source",
"time": "$.time",
"type": "$.detail-type",
"region": "$.region",
"account": "$.account"
}
Note
<data>
must be passed without quotes
{
"specversion": "1.0",
"id": "<id>",
"source": "<source>",
"type": "<type>",
"time": "<time>",
"awsregion": "<region>",
"account": "<account>",
"data": <data>
}
{
"specversion": "1.0",
"id": "dbc1c73a-c51d-0c0e-ca61-ab9278974c57",
"source": "kafka-connect.my-json-values-connector",
"type": "kafka-connect-json-values-topic",
"time": "2023-05-23T11:38:46Z",
"awsregion": "us-east-1",
"account": "1234567890",
"data": {
"topic": "json-values-topic",
"partition": 0,
"offset": 0,
"timestamp": 1684841916831,
"timestampType": "CreateTime",
"headers": [],
"key": "order-1",
"value": {
"orderItems": [
"item-1",
"item-2"
],
"orderCreatedTime": "Tue May 23 13:38:46 CEST 2023"
}
}
}