Im running a Python Lambda using cron from event bridge every minute.
what should I pass to my function lambda_handler(event, context):
as event ? since there’e actually not real event, its just a cron job.
Im running a Python Lambda using cron from event bridge every minute.
what should I pass to my function lambda_handler(event, context):
as event ? since there’e actually not real event, its just a cron job.
2
Answers
Why are you passing anything to the handler? Are you asking purely for testing purposes?
Like you said, the event isn’t important in this scenario, so your code can safely ignore the event, which means you don’t need to pass anything when you are testing either.
When your Lambda function is deployed, AWS will be the one calling the
lambda_handler
function. That is the entry point to your code. You never calllambda_handler
directly via your code.There will be an event associated with the EventBridge request: it will be a
Scheduled Event
event.Here’s an example from the documentation:
You’ll never need to specify neither the
event
nor thecontext
arguments.