8

I articulate the question as follows:

  1. Is the EventBridge event relayed to the ECS Task? (I can't see how much useful it could be if the event is not relayed).

  2. If the event is relayed, then how to able to extract it from within say a Node app running as Task.

Some Context is Due: It is possible to set an EventBridge rule to trigger ECS Fargate Tasks as the result of events sourced from, say, CodeCommit. Mind you, the issue here is the sink/target, not the source. I was able to trigger a Fargate Task as I updated my repo. I could have used other events. My challenge resides in extracting the event relayed (in this case, repository name, commitId, etc from Fargate.)

The EventBridge documentation is clear on how to set the rules to trigger events but is mum on how events can be extracted - which makes sense as the sink/target documentation would have the necessary reference. But ECS documentation is not clear on how to extract relayed events.

I was able to inspect the metadata and process.env. I could not find the event in either of the stores.

I have added a CloudWatch Log Group as a target for the same rule and was able to extract the event. So it certainly relayed to some of the targets, but not sure if events are relayed to ECS Task.

Therefore, the questions arise: is the event relayed to the ECS Task? If so, how would you access it?

Anthony
  • 5,176
  • 6
  • 65
  • 87
  • Similar to https://stackoverflow.com/questions/62807320/how-to-get-the-event-content-in-ecs-when-it-is-invoked-by-cloudwatch-eventbridge Sadly all existing answers involve some intermediary (lambda or SQS) which add to complexity. it would be better to not have to take the "scenic route" . – Anthony Sep 04 '20 at 15:23
  • Oddly, there's a similar system called "AWS Batch" where this is trivially supported https://docs.aws.amazon.com/batch/latest/userguide/batch-cwe-target.html – Anthony Sep 04 '20 at 16:00
  • 1
    Step Functions are way better but, use a step function. – Derrops Sep 11 '20 at 06:38
  • Does this answer your question? [How to get the event content in ECS when it is invoked by cloudwatch/eventbridge event?](https://stackoverflow.com/questions/62807320/how-to-get-the-event-content-in-ecs-when-it-is-invoked-by-cloudwatch-eventbridge) – blr Dec 31 '20 at 19:05

0 Answers0