AwsEventbridge

Service-level AWS EventBridge component.

Remarks

Supported capabilities:

  • scheduler — creates an EventBridge Scheduler schedule via AwsEventbridgeScheduler.
  • eventBus — creates an EventBridge event bus (and optional resource-based policy) via AwsEventbridgeEventBus.
  • eventRule — creates an EventBridge rule with optional targets via AwsEventbridgeEventRule.
  • pipe — creates an EventBridge Pipe connecting a source to a target via AwsEventbridgePipe.
  • connection — creates an EventBridge Connection for API Destination authentication via AwsEventbridgeConnection.
  • defaultEventBus — creates the standard project-and-environment EventBridge event bus.

Schedule groups are created separately through AwsEventbridgeScheduleGroup and reused by schedules via scheduler.groupName.

Naming:

  • Root type ${namespace}:aws:AwsEventbridge selects capability eventbridge-scheduler, eventbridge-event-bus, eventbridge-event-rule, eventbridge-pipe, eventbridge-connection, or eventbridge-default-event-bus from the active union arm. Its SHARED logical/provider identity comes from that arm's name, or defaultEventBus.identity; target ${env}-${projectHash}-<selected-capability>-${sanitiseNamePart(identity)}.
  • Each selected capability is an independently constructible root using its own args.name; the facade never supplies a positional identity. Their provider children use the raw capability args.name as their sole child discriminator.
  • Event bus, event rule, connection, pipe and scheduler AWS names use the stackAndPurpose style ${env}-${projectHash}-<purpose>.
  • The default event bus uses the fixed events purpose with stackAndPurpose, yielding ${env}-${projectHash}-events.
  • Event-bus policies and event targets set no standalone AWS name (targets use their targetId).

Example

CODE
const hourlySync = new AwsEventbridge({
  scheduler: {
    name: 'hourlySync',
    scheduleExpression: 'rate(1 hours)',
    flexibleTimeWindow: { mode: 'OFF' },
    target: {
      arn: myQueue.arn,
      roleArn: schedulerRole.arn,
    },
    description: 'Triggers hourly data sync',
  },
});

export const scheduleArn = hourlySync.scheduler?.arn;
CODE
const backupGroup = new AwsEventbridgeScheduleGroup({
  name: 'ceGithubBackup',
});

const backupTrigger = new AwsEventbridge({
  scheduler: {
    name: 'triggerBackup',
    groupName: backupGroup.name,
    scheduleExpression: 'cron(0 4 ? * * *)',
    flexibleTimeWindow: { mode: 'OFF' },
    target: {
      arn: stateMachineArn,
      roleArn: schedulerRole.arn,
    },
  },
});

export const backupScheduleArn = backupTrigger.scheduler?.arn;
CODE
const defaultBus = new AwsEventbridge({
  defaultEventBus: {
    identity: 'events',
  },
});
CODE
const orderRule = new AwsEventbridge({
  eventRule: {
    name: 'orderEvents',
    defaultEventBus: defaultBus.defaultEventBus!,
    eventPattern: JSON.stringify({
      source: ['myapp.orders'],
      'detail-type': ['OrderPlaced'],
    }),
    targets: { processOrder: { lambda: { function: processOrderFn } } },
  },
});

export const ruleArn = orderRule.eventRule?.arn;
CODE
const auditBus = new AwsEventbridge({
  eventBus: { name: 'auditEvents' },
});

const auditRule = new AwsEventbridge({
  eventRule: {
    name: 'auditEvents',
    eventBus: auditBus.eventBus!,
    eventPattern: JSON.stringify({ source: ['myapp.audit'] }),
  },
});
CODE
const ordersForwarder = new AwsEventbridge({
  pipe: {
    name: 'ordersForwarder',
    iamRole: pipeRole.arn,
    source: sourceQueue.arn,
    target: targetQueue.arn,
    description: 'Routes order events from SQS to SQS',
    sourceParameters: {
      sqsQueue: { batchSize: 10 },
    },
  },
});

export const pipeArn = ordersForwarder.pipe?.arn;
CODE
const apiConn = new AwsEventbridge({
  connection: {
    name: 'myApiConn',
    authorizationType: 'API_KEY',
    authParameters: {
      apiKey: { key: 'x-api-key', value: 'supersecret' },
    },
  },
});

export const connArn = apiConn.connection?.arn;

Constructors

new AwsEventbridge( args: AwsEventbridgeArgs, options?: ComponentResourceOptions, ): AwsEventbridge

Parameters

  • args (AwsEventbridgeArgs) — Service-level EventBridge capability inputs.The component logical name is derived from the selected capability name field as ${environmentCode}-${projectHash}-eventbridge-${sanitisedIdentity}.Capability identity fields must be non-empty synchronous plain strings and are validated fail-fast before any resources are created.
  • options (ComponentResourceOptions, optional) — Optional settings controlling resource behaviour.

Returns

AwsEventbridge

Hierarchy

  • ComponentResource
  • AwsEventbridge

Properties

connection: AwsEventbridgeConnection

readonly

Optional EventBridge Connection capability created by this component.

defaultEventBus: AwsEventbridgeDefaultEventBus

readonly

Optional standard EventBridge event bus created for this project and environment.

eventBus: AwsEventbridgeEventBus

readonly

Optional EventBridge Event Bus capability created by this component.

eventRule: AwsEventbridgeEventRule

readonly

Optional EventBridge Event Rule capability created by this component.

pipe: AwsEventbridgePipe

readonly

Optional EventBridge Pipe capability created by this component.

scheduler: AwsEventbridgeScheduler

readonly

Optional EventBridge Scheduler capability created by this component.

urn: Output<string>

readonly

Inherited from urn

The stable logical URN used to distinctly address a resource, both before and after deployments.

Methods

getData(): Promise<any>

protectedasync

Inherited from getData

Retrieves the data produces by initialize. The data is immediately available in a derived class's constructor after the super(...) call to ComponentResource.

Returns

  • Promise<any>

getProvider(moduleMember: string): ProviderResource | undefined

Inherited from getProvider

Returns the provider for the given module member, if one exists.

Parameters

  • moduleMember (string)

Returns

  • ProviderResource | undefined

initialize( args: Inputs, opts?: ComponentResourceOptions, name?: string, type?: string, ): Promise<any>

protectedasync

Inherited from initialize

Can be overridden by a subclass to asynchronously initialize data for this component automatically when constructed. The data will be available immediately for subclass constructors to use. To access the data use getData.

Parameters

  • args (Inputs)
  • opts (ComponentResourceOptions, optional)
  • name (string, optional)
  • type (string, optional)

Returns

  • Promise<any>

registerOutputs( outputs?: Inputs | Promise<Inputs> | Output<Inputs>, ): void

protected

Inherited from registerOutputs

Registers synthetic outputs that a component has initialized, usually by allocating other child sub-resources and propagating their resulting property values.

Component resources can call this at the end of their constructor to indicate that they are done creating child resources. This is not strictly necessary as this will automatically be called after the initialize method completes.

Parameters

  • outputs (Inputs | Promise<Inputs> | Output<Inputs>, optional)

Returns

  • void

Static Methods

isInstance(obj: any): obj is ComponentResource<any>

static

Inherited from isInstance

Returns true if the given object is a CustomResource. This is designed to work even when multiple copies of the Pulumi SDK have been loaded into the same process.

Parameters

  • obj (any)

Returns

  • obj is ComponentResource<any>