How to manually trigger EventBridge Schedule?

1

We have an EventBridge Schedule that has a cron schedule expression to run everyday 12am. Is there a way to manually trigger the Schedule? It'd make testing significantly easier.

質問済み 8ヶ月前3966ビュー
2回答
5

This is really great question, as there is no way of doing that until you change the schedule for next minute and wait a minute to invoke it.

I do this quite often and here is how I do it via CLI, which is very handy way of doing this:

Let's say, right now time is 21:26EST and I want my lambda function to be invoked now, so I'll update my schedule as below

 aws scheduler update-schedule --name <Schedule_name> --schedule-expression "cron(27 21 * * ? *)" --flexible-time-window '{ "Mode": "OFF" }' --target '{ "Arn": "<Lambda_Function_Arn>", "RoleArn": "<Role_Arn_Used_In_Scheduler>" }' --profile <CLI_Profile_Name>

As my lambda function gets invoked, I'll revert the changes as below considering 12:00am is your actual schedule:

 aws scheduler update-schedule --name <Schedule_name> --schedule-expression "cron(00 00 * * ? *)" --flexible-time-window '{ "Mode": "OFF" }' --target '{ "Arn": "<Lambda_Function_Arn>", "RoleArn": "<Role_Arn_Used_In_Scheduler>" }' --profile <CLI_Profile_Name>

This may not be the exact answer, but this is very handy comparing to updating the same on console.

Hope you find this helpful.

Comment here if you have additional questions, happy to help.

Abhishek

profile pictureAWS
エキスパート
回答済み 8ヶ月前
  • Thanks! We used to use that trick for EventBridge Rules. I was hoping Eventbridge Scheduler would a native feature to do that.

    Another use case we have is that we want to provide our users with a way to manually trigger cron Schedules (eg, syncing third-party integrations).

    We can write code to manually trigger the underlying Schedule target, but it'd be nice to just have an EventBridge Scheduler action to manually trigger the Schedule.

2

Hello.

As far as I know, there is no way to do it manually.
Therefore, if you want to check the operation, I think it is best to try shortening the cron interval for now.

profile picture
エキスパート
回答済み 8ヶ月前

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

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

質問に答えるためのガイドライン

関連するコンテンツ