EventBus

A custom EventBridge event bus with pattern-matching rules that route events to Lambda functions or SQS queues.

Messaging · anvil:aws:EventBus

Arguments

Names below are TypeScript (camelCase). In Python use snake_case (e.g. dataClassification → data_classification); in Go use PascalCase on the Args struct (e.g. DataClassification).

rules
array

EventBridge rules on this bus. Each rule matches events by pattern and routes them to a target.

rules[] 3 fields

An EventBridge rule that matches events by pattern and routes them to a target.

name required
string

Logical name for this rule. Used to construct the physical rule name.

pattern required
object (EventBusRulePattern)

Defines which events this rule matches.

target required
object (EventBusRuleTarget)

Defines what receives matching events.

rules[].pattern 3 fields

EventBridge content-based filtering pattern. All fields are AND-ed — an event must match every specified field.

detail
string

Matches against fields inside the event detail payload. Structure depends on the event producer. e.g. { "orderId": [{ "exists": true }], "status": ["pending"] }

detailType
array<string>

Filters on the detail-type field. e.g. ["order.created", "order.cancelled"]

source
array<string>

Filters on the event source field. e.g. ["anvil.api", "anvil.worker"]

rules[].target 1 field

Target that receives matching events from an EventBridge rule.

lambda
object (EventBusLambdaTargetArgs)

Invoke a Lambda function when events match the rule pattern. Anvil creates the EventBridge target and grants EventBridge permission to invoke the function.

rules[].target.lambda 2 fields

Lambda function target for an EventBridge rule. Pass fn.arn and fn.roleArn from an Anvil Lambda component.

arn required
string

The ARN of the Lambda function to invoke. Use fn.arn from an Anvil Lambda component.

lambdaRoleArn required
string

The ARN of the Lambda's execution role. Use fn.roleArn from an Anvil Lambda component.

This component also accepts a hatch argument to override the underlying resource configuration. See Overrides & Escape Hatch.

Attributes

Outputs available once the resource is deployed.

name
string

The name of the EventBridge event bus. Pass to HttpApi consumer: { eventBridge: { name: bus.name } }.

arn
string

The ARN of the EventBridge event bus.