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

0

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?

3개 답변
1
수락된 답변

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 fiel.

profile pictureAWS
전문가
Uri
답변함 일 년 전
profile picture
전문가
검토됨 한 달 전
0

Thanks Uri,

another option that I found is to include PartitionKey inside Detail,

then in Target Rule add: \"InputPath\":\"$.detail\" , \"KinesisParameters\":{\"PartitionKeyPath\":\"$.detail.PartitionKey\"}

답변함 일 년 전
  • This is exactly what I means by using the Input Transformer.

0

It looks like the Kinesis Data Stream needs to receive PartitionKey but I can't include PartitionKey in the EventBridge Event. I'm trying this:

aws events put-events --entries '[{"Source": "my.source", "DetailType": "my.detailtype", "Detail": "{\"key\": \"value\"}", "PartitionKey": "my_partition_key", "EventBusName": "myEventBus"}]'

But I get this error: Unknown parameter in Entries[0]: "PartitionKey", must be one of: Time, Source, Resources, DetailType, Detail, EventBusName, TraceHeader

Any clue?

답변함 일 년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠