Amazon Web Services (AWS) - Create EventBridge Schedule using the AWS CLI

by
Jeremy Canfield |
Updated: July 13 2024
| Amazon Web Services (AWS) articles
If you are not familiar with Amazon Web Services (AWS) EventBridge Scheduler, check out my article Schedule reoccurring Lambda Function using EventBridge Scheduler.
This assumes you have already configured the aws command line tool. If not, check out my article on Getting Started with the AWS CLI.
The aws scheduler create-schedule command can be used to create a new EventBridge Schedule. In this example the EventBridge Schedule will invoke Lambda Function "my_lambda_function" using cron schedule cron(00 08 1 * ? *) which means the first day of each month at 8:00 am in the America/Chicago timezone and payload foo:Hello and bar:World are sent into the Lambda Function.
aws scheduler create-schedule \
--name my_schedule \
--schedule-expression "cron(00 08 1 * ? *)" \
--flexible-time-window Mode=OFF \
--state ENABLED \
--schedule-expression-timezone "America/Chicago" \
--group-name default \
--target '{"Arn": "arn:aws:lambda:us-east-1:123456789012:function:my_lambda_function", "RoleArn": "arn:aws:iam::123456789012:role/service-role/Amazon_EventBridge_Scheduler_LAMBDA_my_schedule", "Input": "{\"foo\":\"Hello\",\"bar\":\"World\"}"}'
Did you find this article helpful?
If so, consider buying me a coffee over at