Creates or updates the specified rule. Rules are enabled by default, or
based on value of the state. You can disable a rule using
A single rule watches for events from a single event bus. Events
generated by AWS services go to your account's default event bus. Events
generated by SaaS partner services or applications go to the matching
partner event bus. If you have custom applications or services, you can
specify whether their events go to your default event bus or a custom
event bus that you have created. For more information, see
If you are updating an existing rule, the rule is replaced with what you
specify in this
put_rule command. If you omit
put_rule, the old values for
those arguments are not kept. Instead, they are replaced with null
When you create or update a rule, incoming events might not immediately start matching to new or updated rules. Allow a short period of time for changes to take effect.
A rule must contain at least an EventPattern or ScheduleExpression. Rules with EventPatterns are triggered when a matching event is observed. Rules with ScheduleExpressions self-trigger based on the given schedule. A rule can have both an EventPattern and a ScheduleExpression, in which case the rule triggers on matching events as well as on a schedule.
When you initially create a rule, you can optionally assign one or more
tags to the rule. Tags can help you organize and categorize your
resources. You can also use them to scope user permissions, by granting
a user permission to access or change only rules with certain tag
values. To use the
put_rule operation and
assign tags, you must have both the
If you are updating an existing rule, any tags you specify in the
put_rule operation are ignored. To update the
tags of an existing rule, use
Most services in AWS treat : or / as the same character in Amazon Resource Names (ARNs). However, EventBridge uses an exact match in event patterns and rules. Be sure to use the correct ARN characters when creating event patterns so that they match the ARN syntax in the event you want to match.
In EventBridge, it is possible to create rules that lead to infinite loops, where a rule is fired repeatedly. For example, a rule might detect that ACLs have changed on an S3 bucket, and trigger software to change them to the desired state. If the rule is not written carefully, the subsequent change to the ACLs fires the rule again, creating an infinite loop.
To prevent this, write the rules so that the triggered actions do not re-fire the same rule. For example, your rule could fire only if ACLs are found to be in a bad state, instead of after any change.
An infinite loop can quickly cause higher than expected charges. We recommend that you use budgeting, which alerts you when charges exceed your specified limit. For more information, see Managing Your Costs with Budgets.
eventbridge_put_rule(Name, ScheduleExpression, EventPattern, State, Description, RoleArn, Tags, EventBusName)
[required] The name of the rule that you are creating or updating.
The scheduling expression. For example, "cron(0 20 * * ? *)" or "rate(5 minutes)".
The event pattern. For more information, see Events and Event Patterns in the Amazon EventBridge User Guide.
Indicates whether the rule is enabled or disabled.
A description of the rule.
The Amazon Resource Name (ARN) of the IAM role associated with the rule.
The list of key-value pairs to associate with the rule.
The name or ARN of the event bus to associate with this rule. If you omit this, the default event bus is used.
A list with the following syntax:
1 2 3
list( RuleArn = "string" )
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.