Bulk Create EventBridge Scheduler Schedules Using AWS CLI

Use AWS CLI to bulk create multiple Amazon EventBridge Scheduler schedules in a loop with dynamic naming and rate expressions targeting AWS Lambda

This snippet demonstrates how to bulk create multiple Amazon EventBridge Scheduler schedules using the AWS CLI in a shell loop. It uses aws scheduler create-schedule inside a for loop to create multiple schedules with dynamic names and varying rate expressions, all targeting the same AWS Lambda function. This is useful when you need to provision many schedules at once for batch processing, multi-tenant workloads, or automated provisioning scenarios.

Copy the commands on your CLI and replace the LAMBDA_ARN and the EVENTBRIDGE_ROLE_ARN. Modify the loop count and rate expressions as desired

for i in $(seq 1 5); do
  aws scheduler create-schedule \
    --name "bulk-schedule-$i" \
    --group-name "default" \
    --schedule-expression "rate($((i * 5)) minutes)" \
    --target '{
      "Arn": "<LAMBDA_ARN>",
      "RoleArn": "<EVENTBRIDGE_ROLE_ARN>"
    }' \
    --flexible-time-window '{"Mode": "OFF"}' \
  && echo "Created schedule: bulk-schedule-$i"
done
                                


Created by:

Sahithi Ginjupalli

Sahithi Ginjupalli

Sahithi Ginjupalli is a Cloud Engineer with a passion for continuous learning and in-depth exploration of her field. She helps optimize client applications through strategic implementation of AWS services, enhancing their efficiency and performance.

Follow on LinkedIn