54
48

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

AWS Lambda - Scheduled EventのCron書式

Last updated at Posted at 2015-10-12

AWS Lambdaで、Scheduled Eventをcron形式で設定しようとしたら小ハマりしたので備忘録。基本的には以下の話そのまま。

Walkthrough 5: Using Lambda Functions to Process Scheduled Events (Python)
http://docs.aws.amazon.com/ja_jp/lambda/latest/dg/getting-started-scheduled-events.html

基本書式

各項目は半角スペース区切りで、時間はUTCで指定する。

cron(Minutes Hours Day-of-month Month Day-of-week Year)

「分、時、日、月、曜日、年」の順ですね。一般的なcronにはyearは無いわけで、一枠多いことにご注意。

サンプル

上のリンクのサンプルそのままですが。注意すべきはDay-of-weekのところ、「*」だと通らないので「?」を使う必要あり。

Example Cron expression
毎日 10:00am (UTC) cron(0 10 * * ? *)
毎日 12:15am (UTC) cron(15 12 * * ? *)
月曜から金曜の 06:00pm (UTC) cron(0 18 ? * MON-FRI *)
毎月1日の 8:00am (UTC) cron(0 8 1 * ? *)
月曜から金曜 (UTC) で10分ごと cron(0/10 * ? * MON-FRI *)
月曜から金曜、8:00am - 5:55pm の間(UTC)で5分ごと cron(0/5 8-17 ? * MON-FRI *)

参考

Cron ジョブを Lambda Scheduled Event に置き換えてサーバーレスを目指す
http://blog.manabusakai.com/2015/10/cron-job-to-lambda-scheduled-event/

54
48
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
54
48

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?