EventBridge & Step Functions: Events and Orchestration
EventBridge and Step Functions solve two different problems that get lumped together as "event-driven AWS."
Busca en todas las páginas de la documentación
EventBridge and Step Functions solve two different problems that get lumped together as "event-driven AWS."
EventBridge answers "something happened, who needs to know." Step Functions answers "here is a sequence of steps, run them in order, track the state, and handle failure." Both are fully managed and both are driven from the SDK the same way as any other AWS service - a client, an operation, a JSON-shaped input.
This page builds the mental model that separates the two, then shows where they meet.
An event is a small JSON record describing something that already happened - an order was placed, a file landed in a bucket, a deployment finished. EventBridge's job is distribution: a producer calls PutEvents, and any rule whose event pattern matches the event's source, detail-type, or detail fields fires, invoking its configured targets (a Lambda function, an SQS queue, a Step Functions state machine, and dozens more).
A workflow, by contrast, is a sequence you want to run to completion - validate an order, charge a card, reserve inventory, notify the customer, and roll back cleanly if any step fails. Step Functions expresses that as a state machine: a JSON document written in ASL, with named states, transitions, and error handling. Each run of it is an execution, and Step Functions tracks that execution's state, input, and output for you.
# --- Python (boto3) ---
import boto3
events = boto3.client("events")
events.put_events(Entries=[{
"Source": "orders.api",
"DetailType": "OrderPlaced",
"Detail": '{"orderId": "ord-1"}',
"EventBusName": "default",
}])// --- TypeScript (AWS SDK v3) ---
import { EventBridgeClient, PutEventsCommand } from "@aws-sdk/client-eventbridge";
const events = new EventBridgeClient({});
await events.send(new PutEventsCommand({
Entries: [{
Source: "orders.api",
DetailType: "OrderPlaced",
Detail: JSON.stringify({ orderId: "ord-1" }),
EventBusName: "default",
}],
}));That single PutEvents call is the whole EventBridge side of "something happened." What runs next, and in what order, is a separate question - one Step Functions is built to answer.
EventBridge's flow is bus -> rule -> target. A bus (the account's default bus, or a custom event bus you create) receives events. A rule on that bus declares an event pattern, a JSON shape matched against incoming events - for example, only OrderPlaced events from orders.api. Every target attached to a matching rule is invoked independently and in parallel; there is no ordering or dependency between them.
Step Functions' flow is definition -> execution -> states. You register a state machine once with CreateStateMachine, passing an ASL definition and a type (STANDARD or EXPRESS). Each StartExecution call runs that definition against a specific input, moving through states such as Task (do work, often calling another AWS API directly), Choice (branch), Wait, Parallel, and Catch/Retry for error handling. Standard executions keep a full, queryable history for up to a year; Express executions are built for high volume and short duration, logging to CloudWatch Logs instead.
The two connect at exactly one seam: EventBridge can target a Step Functions state machine. A PutTargets call whose target ARN is a state machine turns "an event arrived" into "start an execution," passing the event (or a piece of it) as the execution's input.
# --- Python (boto3) ---
import boto3
events = boto3.client("events")
events.put_targets(
Rule="order-placed-rule",
Targets=[{
"Id": "start-fulfillment",
"Arn": "arn:aws:states:us-east-1:111122223333:stateMachine:FulfillOrder",
"RoleArn": "arn:aws:iam::111122223333:role/eventbridge-invoke-sfn",
}],
)// --- TypeScript (AWS SDK v3) ---
import { EventBridgeClient, PutTargetsCommand } from "@aws-sdk/client-eventbridge";
const events = new EventBridgeClient({});
await events.send(new PutTargetsCommand({
Rule: "order-placed-rule",
Targets: [{
Id: "start-fulfillment",
Arn: "arn:aws:states:us-east-1:111122223333:stateMachine:FulfillOrder",
RoleArn: "arn:aws:iam::111122223333:role/eventbridge-invoke-sfn",
}],
}));From here on, EventBridge is out of the picture - the state machine owns the rest of the process.
Think of EventBridge as the notification layer and Step Functions as the process layer. A system commonly uses both together: EventBridge decouples "who needs to react" from the producer, and Step Functions owns any reaction that itself has multiple ordered steps with its own failure handling.
A useful test: if a rule's target is a single, idempotent action (send a notification, write a row, invoke one Lambda), EventBridge alone is enough. If that "one action" is actually several dependent steps - call a payment API, then reserve inventory, then notify, rolling back on failure - that belongs in a state machine, not spread across independent EventBridge targets with no shared state or ordering guarantee.
| Concern | EventBridge alone | Step Functions (optionally via EventBridge) |
|---|---|---|
| Ordering across steps | None - targets run independently | Explicit, defined by the ASL graph |
| Retry of a whole process | Per-target retry only | Catch/Retry per state, and executions are resumable in history |
| Visibility into "where did it fail" | Per-target failure/DLQ | Full execution history (Standard) or CloudWatch Logs (Express) |
| Fan-out to many independent consumers | Native strength | Requires one Task per consumer |
| Cost model | Per event published | Per state transition (Standard) or per request+duration (Express) |
A common mistake is trying to build a multi-step process entirely out of chained EventBridge rules (rule A triggers a Lambda that publishes an event that triggers rule B, and so on). It works, but you lose a single execution history, and debugging "why did step 3 never run" means reconstructing the chain by hand. Step Functions gives you that history for free.
StartExecution can be called directly by any SDK caller; EventBridge is one of many ways to trigger a workflow.EventBridge routes discrete events to independent targets; Step Functions runs an ordered, stateful sequence of steps as one workflow.
Yes. Attach a state machine ARN as a rule's target via PutTargets, with an IAM role EventBridge assumes to call StartExecution.
No. Any SDK caller, a schedule, an API, or another workflow can call StartExecution directly. EventBridge is useful specifically when the trigger is "an event happened somewhere else."
Yes, via the events:PutEvents SDK integration as a Task state, letting a workflow announce its own milestones to other consumers.
Step Functions. A Standard execution keeps a full state-by-state history; EventBridge only reports success or failure per individual target invocation.
No extra service is required - SDK integrations let a state call another AWS API's operation directly by ARN pattern, without a Lambda function in between.
Stack versions: This page was written for boto3 1.43.x (Python 3.10+) and the AWS SDK for JavaScript v3 (Node.js 18+).
Revisado por Chris St. John·Última actualización: 23 jul 2026