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}fromargs.name. - AWS provider rule name: derived explicitly from
args.namevia 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:AwsEventbridgeEventRulehas capabilityeventbridge-event-ruleand SHARED identityargs.name; target${env}-${projectHash}-eventbridge-event-rule-${sanitiseNamePart(args.name)}. - Child
aws:cloudwatch/eventRule:EventRulehas tuple[args.name]. Repeatedaws:cloudwatch/eventTarget:EventTargetchildren have tuple[args.name, targets map key]; the key is both the consumer-supplied identity and the providertargetId. 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 andeventbridge-ruleservice discriminator. - The rule provider
nameusesargs.namewithstackAndPurpose, limited to 51 characters for AWS's 64-character limit. EventTargettargetIdis a semantic identifier forwarded unchanged from its keyed collection identity; the provider owns its documented 64-character[A-Za-z0-9_.-]+constraint validation.
Example
```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.nameis the shared provider-purpose and logical-root identity.options(ComponentResourceOptions, optional) — Optional settings controlling resource behaviour.
Returns
AwsEventbridgeEventRule
Hierarchy
ComponentResourceAwsEventbridgeEventRule
Properties
arn: Output<string>
The ARN of the rule.
lambdaInvokePermissions: Resource[]
Lambda invoke permissions created for managed Lambda targets.
rule: EventRule
The underlying AWS EventBridge rule resource.
targets: Record<string, aws.cloudwatch.EventTarget>
The target resources attached to this rule.
urn: Output<string>
Inherited from urn
The stable logical URN used to distinctly address a resource, both before and after deployments.
Methods
getData(): Promise<any>
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>
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
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>
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>