LoginSignup
0
0

Lambda関数の実行予約をする

Posted at

■適当なLambdaを選択する
以下のコードを入力する

import json

def lambda_handler(event, context):
    # TODO implement
    print('test成功')
    return {
        'statusCode': 200,
        'body': json.dumps('Hello from Lambda!')
    }

■イベントを設定する
『設定』⇒『トリガー』と進め『EventBridge』と選択しする。
スケジュール式で『cron(35 12 27 04 ? 2024)』と入力する♢
※UTCの時間指定なので、日本との時差は9時間で計算する。上記の場合は、日本時間の21時35分に実行される

■モニタリングの『CloudWatchログを表示』から実行を確認できる
demo

♢ローカルタイムの時間確認ができた
Amazon EventBridge⇒ルールと進む
demo
イベントスケジュールから確認できる
demo
demo
⇒Lamdbaの関数に紐づけると、トリガーとして追加されていた

♢パラメーターを渡す方法
ルール編集のターゲット選択から『入力トランスフォームを設定』を選んで、以下のように設定すると『テンプレート』のほうのパラムを渡すことができる
demo
demo

0
0
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
0
0