Skip to content

AWS.Scheduler reference

Source: src/AWS/Scheduler/CreateSchedule.ts

Runtime binding for scheduler:CreateSchedule — THE dynamic-scheduling pattern (per-user reminders, delayed callbacks): a deployed Lambda mints one-shot at(...) or recurring schedules at runtime.

The binding is constructed with the schedule execution role (the IAM role EventBridge Scheduler assumes to invoke the target) and, optionally, a ScheduleGroup that scopes which schedules the host may create. At deploy time it contributes BOTH scheduler:CreateSchedule on the group’s schedule ARN pattern AND iam:PassRole on the execution role — without the PassRole statement schedule creation fails only at runtime.

CreateSchedule: Creating Schedules At Runtime

Section titled “CreateSchedule: Creating Schedules At Runtime”

Mint A One-Shot Schedule From A Lambda

// deploy time: pre-create the execution role Scheduler will assume
const role = yield* AWS.IAM.Role("ReminderRole", {
assumeRolePolicyDocument: {
Version: "2012-10-17",
Statement: [
{
Effect: "Allow",
Principal: { Service: "scheduler.amazonaws.com" },
Action: ["sts:AssumeRole"],
},
],
},
inlinePolicies: {
SendReminder: {
Version: "2012-10-17",
Statement: [
{
Effect: "Allow",
Action: ["sqs:SendMessage"],
Resource: [queue.queueArn],
},
],
},
},
});
const createSchedule = yield* AWS.Scheduler.CreateSchedule(role);
// runtime: schedule a one-shot delivery in 15 minutes
const queueArn = yield* queue.queueArn;
yield* createSchedule({
Name: `reminder-${userId}`,
ScheduleExpression: "at(2026-01-01T00:00:00)",
ActionAfterCompletion: "DELETE",
Target: {
Arn: yield* queueArn,
Input: JSON.stringify({ userId }),
},
});

Scope Creation To A Schedule Group

const group = yield* AWS.Scheduler.ScheduleGroup("Reminders", {});
const createSchedule = yield* AWS.Scheduler.CreateSchedule(role, group);
// runtime calls create schedules inside the group only

Source: src/AWS/Scheduler/DeleteSchedule.ts

Runtime binding for scheduler:DeleteSchedule.

Pairs with CreateSchedule for the dynamic-scheduling pattern: a deployed Lambda deletes schedules it minted at runtime (cancel a reminder, clean up a completed one-shot). Optionally scoped to a ScheduleGroup; without one it covers the default group.

DeleteSchedule: Deleting Schedules At Runtime

Section titled “DeleteSchedule: Deleting Schedules At Runtime”

Cancel A Reminder

const deleteSchedule = yield* AWS.Scheduler.DeleteSchedule();
// runtime
yield* deleteSchedule({ Name: `reminder-${userId}` }).pipe(
// already gone — cancellation is idempotent
Effect.catchTag("ResourceNotFoundException", () => Effect.void),
);

Scope Deletion To A Schedule Group

const deleteSchedule = yield* AWS.Scheduler.DeleteSchedule(group);

Source: src/AWS/Scheduler/GetSchedule.ts

Runtime binding for scheduler:GetSchedule.

Pairs with CreateSchedule for the dynamic-scheduling pattern: a deployed Lambda inspects schedules it minted at runtime (is the reminder still pending?). Optionally scoped to a ScheduleGroup; without one it covers the default group.

Check A Pending Reminder

const getSchedule = yield* AWS.Scheduler.GetSchedule();
// runtime
const schedule = yield* getSchedule({ Name: `reminder-${userId}` });
console.log(schedule.State, schedule.ScheduleExpression);

Scope Reads To A Schedule Group

const getSchedule = yield* AWS.Scheduler.GetSchedule(group);

Source: src/AWS/Scheduler/ListSchedules.ts

Runtime binding for scheduler:ListSchedules.

Pairs with CreateSchedule for the dynamic-scheduling pattern: a deployed Lambda enumerates the schedules it minted at runtime (sweep pending reminders, count outstanding one-shots). Listing is always scoped to the bound ScheduleGroup — or the default group when none is given. Note: IAM evaluates scheduler:ListSchedules against the account-wide schedule/*​/* pattern (not the group), so the binding grants on that pattern while the request’s GroupName filter keeps results group-scoped.

ListSchedules: Listing Schedules At Runtime

Section titled “ListSchedules: Listing Schedules At Runtime”

Sweep Pending Reminders

const listSchedules = yield* AWS.Scheduler.ListSchedules();
// runtime: enumerate this app's runtime-minted reminders
const page = yield* listSchedules({ NamePrefix: "reminder-" });
for (const schedule of page.Schedules) {
console.log(schedule.Name, schedule.State);
}

Scope Listing To A Schedule Group

const listSchedules = yield* AWS.Scheduler.ListSchedules(group);

Source: src/AWS/Scheduler/Schedule.ts

An EventBridge Scheduler schedule.

Schedule is the canonical time-based delivery primitive. High-level helpers like every, cron, and at can synthesize the target role and scheduler target configuration on top of this resource.

const schedule = yield* Schedule("HourlyJob", {
scheduleExpression: "rate(1 hour)",
target: {
Arn: fn.functionArn,
RoleArn: role.roleArn,
},
flexibleTimeWindow: {
Mode: "OFF",
},
});

Source: src/AWS/Scheduler/ScheduleEventSource.ts

Deploy-time half of consumeSchedule: synthesize the execution role that lets EventBridge Scheduler invoke the host Function and create the backing Schedule whose Input template carries the typed event envelope.

Source: src/AWS/Scheduler/ScheduleGroup.ts

An EventBridge Scheduler schedule group.

Schedule groups provide a namespace for schedules so higher-level helpers can organize recurring jobs separately from one-shot or operational schedules.

const group = yield* ScheduleGroup("Operations", {
tags: {
domain: "ops",
},
});

Source: src/AWS/Scheduler/UpdateSchedule.ts

Runtime binding for scheduler:UpdateSchedule.

Pairs with CreateSchedule for the dynamic-scheduling pattern: a deployed Lambda reschedules or pauses schedules it minted at runtime (push a reminder back, disable a recurring job). UpdateSchedule is a full PUT — unspecified fields are reset to their defaults, so send the complete desired configuration.

Like CreateSchedule, the binding is constructed with the schedule execution role and optionally a scoping ScheduleGroup; it contributes both scheduler:UpdateSchedule on the group’s schedule ARN pattern and iam:PassRole on the execution role.

UpdateSchedule: Updating Schedules At Runtime

Section titled “UpdateSchedule: Updating Schedules At Runtime”

Reschedule A Reminder

const updateSchedule = yield* AWS.Scheduler.UpdateSchedule(role);
// runtime: push the reminder back a day (full PUT — resend the target)
yield* updateSchedule({
Name: `reminder-${userId}`,
ScheduleExpression: "at(2026-01-02T00:00:00)",
ActionAfterCompletion: "DELETE",
Target: {
Arn: yield* queueArn,
Input: JSON.stringify({ userId }),
},
});

Scope Updates To A Schedule Group

const updateSchedule = yield* AWS.Scheduler.UpdateSchedule(role, group);