Skip to content
v2.275.0

EventBus Class ​

Notify an existing Event Bus of an event.

Example ​

ts
const rule = new events.Rule(this, 'Rule', {
  schedule: events.Schedule.expression('rate(1 minute)'),
});

rule.addTarget(new targets.EventBus(
  events.EventBus.fromEventBusArn(
    this,
    'External',
    `arn:aws:events:eu-west-1:999999999999:event-bus/test-bus`,
  ),
));
python
rule = events.Rule(self, "Rule",
    schedule=events.Schedule.expression("rate(1 minute)")
)

rule.add_target(targets.EventBus(
    events.EventBus.from_event_bus_arn(self, "External", "arn:aws:events:eu-west-1:999999999999:event-bus/test-bus")))
java
Rule rule = Rule.Builder.create(this, "Rule")
        .schedule(Schedule.expression("rate(1 minute)"))
        .build();

rule.addTarget(new EventBus(EventBus.fromEventBusArn(this, "External", "arn:aws:events:eu-west-1:999999999999:event-bus/test-bus")));
csharp
// Install: dotnet add package Amazon.CDK.Lib
var rule = new Rule(this, "Rule", new RuleProps {
    Schedule = Schedule.Expression("rate(1 minute)")
});

rule.AddTarget(new EventBus(EventBus.FromEventBusArn(this, "External", "arn:aws:events:eu-west-1:999999999999:event-bus/test-bus")));
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
rule := events.NewRule(this, jsii.String("Rule"), &RuleProps{
	Schedule: events.Schedule_Expression(jsii.String("rate(1 minute)")),
})

rule.AddTarget(targets.NewEventBus(events.EventBus_FromEventBusArn(this, jsii.String("External"), jsii.String("arn:aws:events:eu-west-1:999999999999:event-bus/test-bus"))))

Initializer ​

ts
new EventBus(eventBus: IEventBus, props?: EventBusProps)
python
EventBus(event_bus: IEventBus, props: typing.Optional[EventBusProps] = None)
java
new EventBus(IEventBus eventBus, EventBusProps props)
csharp
new EventBus(IEventBus eventBus, EventBusProps? props = null)
go
NewEventBus(EventBus IEventBus, Props EventBusProps)

Methods ​

bind(rule: IRuleRef, _id?: string): RuleTargetConfigdef bind(self, rule: IRuleRef, _id: typing.Optional[str] = None) -> RuleTargetConfigpublic RuleTargetConfig bind(IRuleRef rule, String _id)public RuleTargetConfig Bind(IRuleRef rule, string? _id = null)func Bind(Rule IRuleRef, _id *string) RuleTargetConfig#
Returns the rule target specification.

NOTE: Do not use the various inputXxx options. They can be set in a call to addTarget.