Create EventBridge Scheduler Schedules with Flexible Time Window Using AWS CLI

Use AWS CLI to create Amazon EventBridge Scheduler schedules with rate and cron expressions along with flexible time windows, targeting AWS Lambda

This snippet demonstrates how to create Amazon EventBridge Scheduler schedules using the AWS CLI aws scheduler create-schedule command with rate and cron expressions along with flexible time windows, targeting AWS Lambda

Cron flexible schedule

aws scheduler create-schedule \
  --name "my-cron-schedule" \
  --schedule-expression "cron(0 9 * * ? *)" \
  --target '{
    "Arn": "<LAMBDA_ARN>",
    "RoleArn": "<EVENTBRIDGE_ROLE_ARN>"
  }' \
 --flexible-time-window '{
    "Mode": "FLEXIBLE",
    "MaximumWindowInMinutes": 15
  }'

                                


Rate flexible schedule

aws scheduler create-schedule \
  --name "my-rate-schedule" \
  --schedule-expression "rate(5 minutes)" \
  --target '{
    "Arn": "<LAMBDA_ARN>",
    "RoleArn": "<EVENTBRIDGE_ROLE_ARN>"
  }' \
  --flexible-time-window '{
    "Mode": "FLEXIBLE",
    "MaximumWindowInMinutes": 15
  }'

                                


Created by:

Archana V

Archana V

Solutions Architect at AWS

Follow on LinkedIn