AwsEventbridgeEventRule

Creates an AWS EventBridge rule, optionally with one or more targets.

Remarks

Wraps aws.cloudwatch.EventRule and creates aws.cloudwatch.EventTarget resources for each entry in args.targets. Naming is deterministic:

  • Pulumi logical name: ${environmentCode}-${projectHash}-eventbridge-event-rule-${sanitisedName} from args.name.
  • AWS provider rule name: derived explicitly from args.name via the naming-style prefix pattern.

Supported target types: Lambda, SQS, SNS, Step Functions, EventBridge bus, and CloudWatch Logs log group.

Naming:

  • Root type ${namespace}:aws:AwsEventbridgeEventRule has capability eventbridge-event-rule and SHARED identity args.name; target ${env}-${projectHash}-eventbridge-event-rule-${sanitiseNamePart(args.name)}.
  • Child aws:cloudwatch/eventRule:EventRule has tuple [args.name]. Repeated aws:cloudwatch/eventTarget:EventTarget children have tuple [args.name, targets map key]; the key is both the consumer-supplied identity and the provider targetId. Candidate names are preflighted as a group before resource construction.
  • Lambda invoke permissions are owned by the referenced Lambda component. This component supplies relationship tuple [args.name, stable suffix of targets map key]; the Lambda component separately adds the function identity and eventbridge-rule service discriminator.
  • The rule provider name uses args.name with stackAndPurpose, limited to 51 characters for AWS's 64-character limit. EventTarget targetId is a semantic identifier forwarded unchanged from its keyed collection identity; the provider owns its documented 64-character [A-Za-z0-9_.-]+ constraint validation.

Example

CODE
```ts
const rule = new AwsEventbridgeEventRule(\{
  name: 'orderEvents',
  defaultEventBus,
  eventPattern: JSON.stringify(\{
    source: ['myapp.orders'],
    'detail-type': ['OrderPlaced'],
  \}),
  targets: \{
    processOrder: \{ lambda: \{ function: processOrderFn \} \},
    deadLetter: \{ sqs: deadLetterQueue.arn \},
  \},
\});

export const ruleArn = rule.arn;
```
Every rule must select exactly one managed bus through `defaultEventBus` or `eventBus`.
Raw names and ARNs, including AWS's built-in `default` event bus, are not accepted.

Constructors

new AwsEventbridgeEventRule( args: AwsEventbridgeEventRuleArgs, options?: ComponentResourceOptions, ): AwsEventbridgeEventRule

Parameters

  • args (AwsEventbridgeEventRuleArgs) — Component inputs; args.name is the shared provider-purpose and logical-root identity.
  • options (ComponentResourceOptions, optional) — Optional settings controlling resource behaviour.

Returns

AwsEventbridgeEventRule

Hierarchy

  • ComponentResource
  • AwsEventbridgeEventRule

Properties

arn: Output<string>

readonly

The ARN of the rule.

lambdaInvokePermissions: Resource[]

readonly

Lambda invoke permissions created for managed Lambda targets.

rule: EventRule

readonly

The underlying AWS EventBridge rule resource.

targets: Record<string, aws.cloudwatch.EventTarget>

readonly

The target resources attached to this rule.

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>