Trigger EventBridge (Simulated)
It says 'Simulated,' but it really does fire AWS EventBridge
- end_image
Here's the first thing to know: the display name says "Trigger EventBridge (Simulated)," but the code does not simulate anything. When this node fires, it calls boto3 and puts a real event onto AWS EventBridge's default bus in us-east-1. The "simulated" in the name is the README's attempt to sound gentler than reality. If you drag this node in without AWS credentials configured, it will fail at runtime with a credential error, not a friendly notice.
So what is it for? The pack's whole design is distributed batch processing on EC2: a fleet of workers each chew through a task folder, and someone upstream needs to know when a task finishes. This node is the "I'm done" signal. You place it at the end of the loop, gate it on the pack's IsLastIndexNode so it only fires for the final image, and it sends a SUCCEEDED event carrying your task_id to EventBridge. An event rule then kicks whatever downstream automation - a Step Function, a Lambda, a message to your team.
How it works
The mechanism is short but has a quirk you should see before it bites you. It takes end_image (IMAGE), is_last (BOOLEAN), and task_id (STRING, default unknown-task), and:
- Skips only when
is_lastisfalseandend_imageis connected (notNone). - Sends the event in every other case.
Read that again, because it's backwards from what you'd expect: the skip condition depends on end_image being present. If you don't wire end_image (and it's technically optional in the code), the node sends an event on every call, is_last be damned. The safe wiring is always is_last → this node, and if you want the gate to actually work, connect end_image too. When it sends, it builds an entry with Source: comfyui.ec2, DetailType: ComfyUI Task State, status SUCCEEDED, your task id, and the current UTC timestamp, then calls put_events. If AWS reports failed entries, it raises a RuntimeError. It's a terminal node - no outputs.
The other half of the story is the README's patch to ComfyUI's execution.py, which does the same thing for failed runs: when any node throws, the patched code logs the error with your task id and pushes a FAILED event. That's the error-reporting side, and it only exists if you hand-apply the patch.
Inputs that matter
is_last- BOOLEAN, required. WireIsLastIndexNodehere.task_id- STRING, defaultunknown-task. WireTaskIDStorageNodehere so the event says which job finished.end_image- IMAGE. Connect the last output image so the skip logic behaves; this is the input the README's "simulation" framing quietly relies on.
Install
Same pack, same install as everything else - ComfyUI Manager search ComfyForEach, or:
cd ComfyUI/custom_nodes
git clone https://github.com/pupba/Comfy_ForEach
cd Comfy_ForEach
pip install -r requirements.txt
Restart. The dependencies include boto3, which you now actually need for this node to work.
Where people get burned
- No credentials, no IAM. The node needs AWS credentials visible to the ComfyUI process and an IAM policy allowing
events:PutEventson the default bus. The README even has a note to "grant it from IAM." This is the node that can't be tested without an AWS account. - Region is hardcoded to
us-east-1. Your events go there no matter where your environment lives. Change it in the source if your bus is elsewhere. - The skip-logic quirk above. Leave
end_imageunconnected and you'll fire an event per iteration, which for a 500-image batch is 500 events and whatever downstream thrashing that triggers. - The "simulation" name. It's not a local log, it's a real API call. If you wanted the JSON-log version the README describes, you'd have to write it yourself - the shipped code is the boto3 call.
Honest verdict: this is the most specialized node in the pack, and it's only useful if you're actually running ComfyUI inside AWS with a task queue. If that's you, great - this is the missing "finished" hook. If you're on a laptop, skip it and use IsLastIndexNode with a plain notification node instead.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| end_image | IMAGE | — | |
| is_last | BOOLEAN | — | |
| task_id | STRING | unknown-task | — |
Outputs (0)
No outputs