# AWS::Events::Rule
Resource Type definition for AWS::Events::Rule
## Syntax
To declare this entity in your AWS CloudFormation template, use the following syntax:
### JSON
<pre>
{
"Type" : "AWS::Events::Rule",
"Properties" : {
"<a href="#eventbusname" title="EventBusName">EventBusName</a>" : <i>String</i>,
"<a href="#eventpattern" title="EventPattern">EventPattern</a>" : <i>String, Map</i>,
"<a href="#scheduleexpression" title="ScheduleExpression">ScheduleExpression</a>" : <i>String</i>,
"<a href="#description" title="Description">Description</a>" : <i>String</i>,
"<a href="#state" title="State">State</a>" : <i>String</i>,
"<a href="#targets" title="Targets">Targets</a>" : <i>[ <a href="target.md">Target</a>, ... ]</i>,
"<a href="#rolearn" title="RoleArn">RoleArn</a>" : <i>String</i>,
"<a href="#name" title="Name">Name</a>" : <i>String</i>
}
}
</pre>
### YAML
<pre>
Type: AWS::Events::Rule
Properties:
<a href="#eventbusname" title="EventBusName">EventBusName</a>: <i>String</i>
<a href="#eventpattern" title="EventPattern">EventPattern</a>: <i>String, Map</i>
<a href="#scheduleexpression" title="ScheduleExpression">ScheduleExpression</a>: <i>String</i>
<a href="#description" title="Description">Description</a>: <i>String</i>
<a href="#state" title="State">State</a>: <i>String</i>
<a href="#targets" title="Targets">Targets</a>: <i>
- <a href="target.md">Target</a></i>
<a href="#rolearn" title="RoleArn">RoleArn</a>: <i>String</i>
<a href="#name" title="Name">Name</a>: <i>String</i>
</pre>
## Properties
#### EventBusName
The name or ARN of the event bus associated with the rule. If you omit this, the default event bus is used.
_Required_: No
_Type_: String
_Update requires_: [Replacement](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-replacement)
#### EventPattern
The event pattern of the rule. For more information, see Events and Event Patterns in the Amazon EventBridge User Guide.
_Required_: No
_Type_: String, Map
_Update requires_: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)
#### ScheduleExpression
The scheduling expression. For example, "cron(0 20 * * ? *)", "rate(5 minutes)". For more information, see Creating an Amazon EventBridge rule that runs on a schedule.
_Required_: No
_Type_: String
_Update requires_: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)
#### Description
The description of the rule.
_Required_: No
_Type_: String
_Update requires_: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)
#### State
The state of the rule.
_Required_: No
_Type_: String
_Allowed Values_: <code>DISABLED</code> | <code>ENABLED</code>
_Update requires_: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)
#### Targets
Adds the specified targets to the specified rule, or updates the targets if they are already associated with the rule.
Targets are the resources that are invoked when a rule is triggered.
_Required_: No
_Type_: List of <a href="target.md">Target</a>
_Update requires_: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)
#### RoleArn
The Amazon Resource Name (ARN) of the role that is used for target invocation.
_Required_: No
_Type_: String
_Update requires_: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt)
#### Name
The name of the rule.
_Required_: No
_Type_: String
_Update requires_: [Replacement](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-replacement)
## Return Values
### Ref
When you pass the logical ID of this resource to the intrinsic `Ref` function, Ref returns the Arn.
### Fn::GetAtt
The `Fn::GetAtt` intrinsic function returns a value for a specified attribute of this type. The following are the available attributes and sample return values.
For more information about using the `Fn::GetAtt` intrinsic function, see [Fn::GetAtt](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference-getatt.html).
#### Id
Returns the <code>Id</code> value.
#### Arn
The ARN of the rule, such as arn:aws:events:us-east-2:123456789012:rule/example.