スキップしてコンテンツを表示

EventBridge Cron Expression for Different Time Intervals

0

I need to create an EventBridge Scheduler rule with the following schedule using cron expressions:

Runs every 10 minutes between 02:00 AM and 02:59 AM UK time (cron(???)). Runs every 5 minutes for the rest of the day (cron(???)). What would be the correct cron expressions for this in AWS EventBridge? Do I need to create two separate rules, or is there a way to define this in a single expression?

Thanks in advance!

質問済み 2年前1080ビュー

1回答
0

To achieve the schedule you've described, you'll need to create two separate rules in AWS EventBridge Scheduler, as a single cron expression cannot accommodate different time intervals for specific hours and the rest of the day.

Here are the cron expressions for the two rules you need:

  1. For running every 10 minutes between 02:00 AM and 02:59 AM UK time: cron(0/10 2 * * ? *)

  2. For running every 5 minutes for the rest of the day: cron(0/5 0-1,3-23 * * ? *)

When creating these rules, make sure to set the time zone to UK time (Europe/London) using the ScheduleExpressionTimezone parameter. This ensures that the schedules run according to UK time, including adjustments for daylight saving time.

The first expression (0/10 2 * * ? *) breaks down as follows:

  • 0/10: Run every 10 minutes
  • 2: Only during the 2 AM hour
  • *: Every day of the month
  • *: Every month
  • ?: Any day of the week
  • *: Every year

The second expression (0/5 0-1,3-23 * * ? *) breaks down as:

  • 0/5: Run every 5 minutes
  • 0-1,3-23: During hours 0-1 and 3-23 (all hours except 2 AM)
  • *: Every day of the month
  • *: Every month
  • ?: Any day of the week
  • *: Every year

By creating these two separate rules with their respective cron expressions, you'll achieve the desired schedule of running every 10 minutes during the 2 AM hour and every 5 minutes for the rest of the day in UK time.
Sources
Schedule types in EventBridge Scheduler - EventBridge Scheduler
CreateSchedule - EventBridge Scheduler

回答済み 2年前

エキスパート

レビュー済み 2年前

ログインしていません。 ログイン 回答を投稿する。

優れた回答とは、質問に明確に答え、建設的なフィードバックを提供し、質問者の専門分野におけるスキルの向上を促すものです。

関連するコンテンツ