Skip to content

EventBridge Scheduler

EventBridge Scheduler is a service that enables you to schedule the execution of your AWS Lambda functions, Amazon ECS tasks, and Amazon Batch jobs. You can use EventBridge Scheduler to create schedules that run at a specific time or at regular intervals. You can also use EventBridge Scheduler to create schedules that run within a flexible time window.

LocalStack allows you to use the Scheduler APIs in your local environment to create and run schedules. The supported APIs are available on our API Coverage section, which provides information on the extent of EventBridge Scheduler’s integration with LocalStack.

This guide is designed for users new to EventBridge Scheduler and assumes basic knowledge of the AWS CLI and our awslocal wrapper script.

Start your LocalStack container using your preferred method. We will demonstrate how you can create a new schedule, list all schedules, and tag a schedule using the EventBridge Scheduler APIs.

You can create a new SQS queue using the CreateQueue API. Run the following command to create a new SQS queue:

Terminal window
awslocal sqs create-queue --queue-name local-notifications

You can fetch the Queue ARN using the GetQueueAttributes API. Run the following command to fetch the Queue ARN by specifying the Queue URL:

Terminal window
awslocal sqs get-queue-attributes \
--queue-url http://sqs.us-east-1.localhost.localstack.cloud:4566/000000000000/local-notifications \
--attribute-names All

Save the Queue ARN for later use.

You can create a new schedule using the CreateSchedule API. Run the following command to create a new schedule:

Terminal window
awslocal scheduler create-schedule \
--name sqs-templated-schedule \
--schedule-expression 'rate(5 minutes)' \
--target '{"RoleArn": "arn:aws:iam::000000000000:role/schedule-role", "Arn":"arn:aws:sqs:us-east-1:000000000000:local-notifications", "Input": "test" }' \
--flexible-time-window '{ "Mode": "OFF"}'
Output
{
"ScheduleArn": "arn:aws:scheduler:us-east-1:000000000000:schedule/default/sqs-templated-schedule"
}

You can list all schedules using the ListSchedules API. Run the following command to list all schedules:

Terminal window
awslocal scheduler list-schedules
Output
{
"Schedules": [
{
"Arn": "arn:aws:scheduler:us-east-1:000000000000:schedule/default/sqs-templated-schedule",
"CreationDate": "2024-07-11T23:13:15.296906+05:30",
"GroupName": "default",
"LastModificationDate": "2024-07-11T23:13:15.296906+05:30",
"Name": "sqs-templated-schedule",
"State": "ENABLED",
"Target": {
"Arn": "arn:aws:sqs:us-east-1:000000000000:local-notifications"
}
}
]
}

You can tag a schedule using the TagResource API. Run the following command to tag a schedule:

Terminal window
awslocal scheduler tag-resource \
--resource-arn arn:aws:scheduler:us-east-1:000000000000:schedule/default/sqs-templated-schedule \
--tags Key=Name,Value=Test

You can view the tags associated with a schedule using the ListTagsForResource API. Run the following command to list the tags associated with a schedule:

Terminal window
awslocal scheduler list-tags-for-resource \
--resource-arn arn:aws:scheduler:us-east-1:00000000
```bash title="Output"
{
"Tags": [
{
"Key": "Name",
"Value": "Test"
}
]
}

EventBridge Scheduler in LocalStack only provides mocked functionality. It does not emulate actual features such as schedule execution or target triggering for Lambda functions or SQS queues.

OperationImplementedImage
Page 1 of 0