CloudWatchEvent
The object describing a CloudWatchEvent event source type.
Amazon Serverless Application Model (Amazon SAM) generates an AWS::Events::Rule resource when this event type is set.
Important Note: EventBridgeRule is the preferred event source type to use, instead of CloudWatchEvent. EventBridgeRule and CloudWatchEvent use the same underlying service, API, and Amazon CloudFormation resources. However, Amazon SAM will add support for new features only to EventBridgeRule.
Syntax
To declare this entity in your Amazon Serverless Application Model (Amazon SAM) template, use the following syntax.
YAML
Enabled:BooleanEventBusName:StringInput:StringInputPath:StringPattern:EventPatternState:String
Properties
-
Enabled -
Indicates whether the rule is enabled.
To disable the rule, set this property to
false.Note
Specify either the
EnabledorStateproperty, but not both.Type: Boolean
Required: No
Amazon CloudFormation compatibility: This property is similar to the
Stateproperty of anAWS::Events::Ruleresource. If this property is set totruethen Amazon SAM passesENABLED, otherwise it passesDISABLED. -
EventBusName -
The event bus to associate with this rule. If you omit this property, Amazon SAM uses the default event bus.
Type: String
Required: No
Default: Default event bus
Amazon CloudFormation compatibility: This property is passed directly to the
EventBusNameproperty of anAWS::Events::Ruleresource. -
Input -
Valid JSON text passed to the target. If you use this property, nothing from the event text itself is passed to the target.
Type: String
Required: No
Amazon CloudFormation compatibility: This property is passed directly to the
Inputproperty of anAWS::Events::Rule Targetresource. -
InputPath -
When you don't want to pass the entire matched event to the target, use the
InputPathproperty to describe which part of the event to pass.Type: String
Required: No
Amazon CloudFormation compatibility: This property is passed directly to the
InputPathproperty of anAWS::Events::Rule Targetresource. -
Pattern -
Describes which events are routed to the specified target. For more information, see Events and Event Patterns in EventBridge in the Amazon EventBridge User Guide.
Type: EventPattern
Required: Yes
Amazon CloudFormation compatibility: This property is passed directly to the
EventPatternproperty of anAWS::Events::Ruleresource. -
State -
The state of the rule.
Accepted values:
DISABLED | ENABLEDNote
Specify either the
EnabledorStateproperty, but not both.Type: String
Required: No
Amazon CloudFormation compatibility: This property is passed directly to the
Stateproperty of anAWS::Events::Ruleresource.
Examples
CloudWatchEvent
The following is an example of a CloudWatchEvent event source type.
YAML
CWEvent: Type: CloudWatchEvent Properties: Enabled: false Input: '{"Key": "Value"}' Pattern: detail: state: - running