CLI cron tasks on AWS Lambda
AWS Lambda lets us run console commands as cron tasks using the
functions: cron: handler: bin/console # or 'artisan' for Laravel runtime: php-81-console events: - schedule: rate: rate(1 hour) input: '"list --verbose"'
The example above will run the
bin/console list --verbose command every hour in AWS Lambda.
Note that the command is a double quoted string:
input value needs to be valid JSON, which means that it needs to be a JSON string, stored in a YAML string.
Read more about the
schedule feature in the Serverless documentation.
If you are interested in cron functions instead, read the Cron functions documentation.