every
Source:
src/AWS/ECS/Schedule.ts
Creates a scheduled EventBridge rule that runs an ECS Fargate task.
every is the high-level ECS scheduling helper for phase 1. It provisions
the EventBridge rule plus the invoke role required to call ecs:RunTask and
iam:PassRole for the target task’s execution roles.
Plain English durations like "1 hour" are normalized to rate(...)
expressions automatically. Full rate(...) and cron(...) expressions are
also accepted as-is.
Examples
Section titled “Examples”Run a task every hour
yield* AWS.ECS.every("HourlyJob", "1 hour", { cluster, task: jobTask, subnets: [privateSubnet1.subnetId, privateSubnet2.subnetId], securityGroups: [jobSecurityGroup.groupId],});Use an explicit cron expression
yield* AWS.ECS.every("NightlyJob", "cron(0 3 * * ? *)", { cluster, task: nightlyTask, subnets: [privateSubnet1.subnetId, privateSubnet2.subnetId], securityGroups: [jobSecurityGroup.groupId],});Run multiple copies with static input
yield* AWS.ECS.every("BatchJob", "30 minutes", { cluster, task: batchTask, subnets: [privateSubnet1.subnetId, privateSubnet2.subnetId], securityGroups: [jobSecurityGroup.groupId], taskCount: 3, input: JSON.stringify({ source: "scheduler" }),});