docs.aws.amazon.com

Note

Scheduled rules are a legacy feature of EventBridge.

EventBridge offers a more flexible and powerful way to create, run, and manage scheduled tasks centrally, at scale: EventBridge Scheduler. With EventBridge Scheduler, you can create schedules using cron and rate expressions for recurring patterns, or configure one-time invocations. You can set up flexible time windows for delivery, define retry limits, and set the maximum retention time for failed API invocations.

Scheduler is highly customizable, and offers improved scalability over scheduled rules, with a wider set of target API operations and AWS services. We recommend that you use Scheduler to invoke targets on a schedule.

For more information, see Create a schedule or the EventBridge Scheduler User Guide.

In EventBridge, you can create two types of scheduled rules:

  • Rules that run at a regular rate

    EventBridge runs these rules at regular intervals; for example, every 20 minutes.

    To specify the rate for a scheduled rule, you define a rate expression.

  • Rules that run at specific times

    EventBridge runs these rules at specific times and dates; for example, 8:00 a.m. PST on the first Monday of every month.

    To specify the time and dates a scheduled rule runs, you define a cron expression.

Rate expressions are simpler to define, while cron expressions offer detailed schedule control. For example, with a cron expression, you can define a rule that runs at a specified time on a certain day of each week or month. In contrast, rate expressions run a rule at a regular rate, such as once every hour or once every day.

All scheduled events use UTC+0 time zone, and the minimum precision for a schedule is one minute.

Note

EventBridge doesn't provide second-level precision in schedule expressions. The finest resolution using a cron expression is one minute. Due to the distributed nature of EventBridge and the target services, there can be a delay of several seconds between the time the scheduled rule is triggered and the time the target service runs the target resource.

Create a scheduled rule (legacy)

The following steps walk you through how to create an EventBridge rule that runs on a regular schedule.

Note

You can only create scheduled rules using the default event bus.

Steps

Define the rule

First, enter a name and description for your rule to identify it.

To define the rule detail
  1. Open the Amazon EventBridge console at https://console.aws.amazon.com/events/ .

  2. In the navigation pane, under Scheduler, choose Scheduled rule (legacy).

  3. Choose Create scheduled rule.

  4. Enter a Name and, optionally, a Description for the rule.

    A rule can't have the same name as another rule in the same AWS Region and on the same event bus.

  5. To have the rule take effect as soon as you create it, make sure the Enable the scheduled rule option is enabled.

Define the schedule

Next, define the schedule pattern.

To define the schedule pattern
  • For Schedule pattern, choose whether you want the schedule to run at a specific time, or at a regular rate:

Select targets

Choose one or more targets to receive events that match the specified pattern. Targets can include an EventBridge event bus, EventBridge API destinations, including SaaS partners such as Salesforce, or another AWS service.

To select targets
  1. For Target type, choose one of the following target types:

  2. For many target types, EventBridge needs permissions to send events to the target. In these cases, EventBridge can create the IAM role needed for your rule to run.

    For Execution role, do one of the following:

    • To create a new execution role for this rule:

      1. Select Create a new role for this specific resource.

      2. Either enter a name for this execution role, or use the name generated by EventBridge.

    • To use an existing execution role for this rule:

      1. Select Use existing role.

      2. Enter or select the name of the execution role to use from the dropdown list.

  3. (Optional) For Additional settings, specify any of the optional settings available for your target type:

  4. (Optional) Choose Add another target to add another target for this rule.

  5. Choose Next.

Configure tags and review rule

Finally, enter any desired tags for the rule, then review and create the rule.

To configure tags, and review and create the rule
  1. (Optional) Enter one or more tags for the rule. For more information, see Tagging resources in Amazon EventBridge.

  2. Choose Next.

  3. Review the details for the new rule. To make changes to any section, choose the Edit button next to that section.

    When satisfied with the rule details, choose Create rule.

Read the original on docs.aws.amazon.com ↗