Show / Hide Table of Contents

CloudWatch Event Source

See CloudWatch Event sample for an example of how to use the CloudWatch Event source.

Syntax

EventBus: String|Expression
Pattern: JSON

Properties

EventBus

The EventBus attribute specifies which event bus to listen to.

Required: Yes

Type: String or Expression

Pattern

The Pattern attribute describes which events are routed to the Lambda function. For more information, see Events and Event Patterns in EventBridge in the Amazon EventBridge User Guide.

For better consistency with the SDK, the attributes can be capitalized and will be converted by the tool automatically. For example, DetailType becomes detail-type, Source becomes source, and so on. Note the renaming is only applied to top-level attributes.

NOTE: The Resources attribute defaults to !Sub "lambdasharp:tier:${Deployment::Tier}" when omitted. Use Resources: null to have no constraints on the resources attribute.

Required: Yes

Type: JSON

Examples

Receive Events from Deployment Tier

The following definition receives events from Sample.Event module of type MyEvent, but only when sent from the same deployment tier.

Sources:
  - EventBus: default
    Pattern:
      Source:
        - Sample.Event
      DetailType:
        - MyEvent
      Resources:
        - !Sub "lambdasharp:tier:${Deployment::Tier}"
In This Article
Back to top Generated by DocFX