Pablo DC
Pablo DC

Reputation: 377

Can an AWS EventBridge Rule target a Kinesis Data Stream (with a custom event, not AWS event)?

In EventBridge I have an Event Bus with 2 Rules. In Kinesis I have a Data Stream.

One of the Rules has as a Target a Log Group in CloudWatch. The second Rule has as a Targe my Data Stream in Kinesis. This Rule has a Role with a Policy to execute all needed actions on my Data Stream.

When I go to my Event Bus and test it using "Send events" button, I see the event in the Log Group but nothing in my Data Stream. In "Event source" I enter: com.mycompany.poc.eventbus EventBridge -> Rule -> Kinesis Streams

I don't find any other activity in Cloud Trail nor Cloud Watch. My Event Pattern is like this:

{
  "source": ["com.mycompany.poc.eventbus"]
}

Does someone have any clue?

Upvotes: 0

Views: 968

Answers (1)

Pablo DC
Pablo DC

Reputation: 377

The solution that I found:

Events in EventBridge can only accept the following fields: Time, Source, Resources, DetailType, Detail, EventBusName, TraceHeader. If you need to pass additional information, such as a partition key, you need to include it inside the Detail field.

If you need to include a Partition key when sending to Kinesis, you will need to use an Input Transformer to create the appropriate structure, and use the key from the Detail field.

Including PartitionKey inside Detail, then in Target Rule add:

\"InputPath\":\"$.detail\" , \"KinesisParameters\":{\"PartitionKeyPath\":\"$.detail.PartitionKey\"}

Upvotes: 0

Related Questions