CLOUD CONCEPT

Cron Expressions

Cron expressions are compact, field-based patterns that define recurring execution times on a calendar.

Cloud Concepts Hub →

What is Cron Expressions

A cron expression tells a scheduler when to initiate work, such as ingesting files, running transformations, or refreshing metadata. Engineers must understand the scheduler’s syntax, time zone, and execution behavior because identical-looking expressions can behave differently across platforms.

Cron expressions describe recurring calendar times rather than the work performed at those times. A scheduler evaluates the expression and initiates a configured target, such as a data ingestion job, workflow, or metadata crawler. This separates scheduling policy from processing logic and makes recurring workloads easier to configure and operate. However, an expression alone does not define dependencies, retries, concurrency limits, or successful completion.

Traditional Unix cron uses five time fields: minute, hour, day of month, month, and day of week. Common operators include an asterisk for all allowed values, commas for multiple values, hyphens for ranges, and slashes for increments within a field. For example, the five-field expression 0 2 * * 1-5 selects 02:00 Monday through Friday in the scheduler’s configured time zone. An expression such as */15 * * * * selects quarter-hour boundaries; it does not mean 15 minutes after the previous execution finishes.

Cron dialects are not interchangeable. AWS scheduling interfaces commonly use a six-field form containing minute, hour, day of month, month, day of week, and year, wrapped in cron(...). For example, cron(0 2 ? * MON-FRI *) selects 02:00 on weekdays. The question mark leaves one day field unspecified; in EventBridge cron syntax, day of month and day of week cannot both be specified simultaneously. Other implementations may include a seconds field or interpret combinations of day fields differently. Validate expressions against the actual scheduler rather than assuming a generic online validator matches it.

Time zones are part of the schedule’s meaning. EventBridge Scheduler supports named time zones, whereas legacy EventBridge scheduled rules and AWS Glue schedules use UTC. Named-zone schedules can preserve a local business hour across daylight saving changes, but skipped or repeated local times require attention. EventBridge Scheduler skips a nonexistent local time during the spring transition and invokes only once for a repeated local time during the autumn transition. Do not assume every scheduler implements the same behavior.

In a data pipeline, a schedule might start ingestion at 01:00 each day and arrange a metadata refresh after ingestion succeeds. Scheduling the crawler independently for 01:15 is simpler, but it creates a timing assumption: a slow ingestion run could leave the crawler scanning incomplete data. Workflow dependencies or completion events are safer when downstream work requires upstream success. Similarly, an object-arrival event may be more appropriate than cron when processing should begin as soon as a file is available.

Apache Airflow adds workflow and data-interval semantics to cron scheduling. With its standard cron data-interval timetable, a daily run is normally scheduled after its data interval ends, so the logical date is not simply the task’s wall-clock start time. Catchup settings determine whether historical intervals are automatically scheduled. Configure start dates, time zones, catchup, and concurrent runs deliberately to avoid unexpected backlogs or overlapping ingestion.

Choose calendar-based cron when requirements specify times such as every weekday at 02:00. Choose a rate or interval schedule when the requirement is a regular elapsed-time cadence, while checking the scheduler’s anchoring behavior. Neither approach guarantees immediate execution or exactly-once processing. Use idempotent writes, appropriate execution permissions, retries, failure monitoring, and overlap controls. AWS Glue job and crawler schedules have five-minute minimum precision, illustrating why a valid expression must also satisfy the target service’s scheduling limits.

Key aspects of Cron Expressions

Correct cron scheduling combines calendar syntax with explicit time zones, dependency handling, and reliable execution controls.

Calendar-based matching

Fields select recurring calendar times, such as weekday mornings or the first day of each month. Increment syntax selects values within a field rather than measuring time since the previous job completed.

Implementation-specific syntax

Field counts, day numbering, special characters, and day-field combination rules vary across schedulers. Validate an expression using the destination platform’s rules before deployment.

Explicit time-zone behavior

A schedule is incomplete without its time zone. Check daylight saving behavior when using local time, or use UTC when a stable global reference is more important than preserving a local business hour.

Separation of timing and dependencies

Cron determines when work becomes eligible to start, not whether upstream data is ready. Use workflow dependencies, readiness checks, or events when a downstream job must wait for successful ingestion.

Reliable execution requires additional controls

Configure permissions, retries, failure handling, and concurrency independently of the expression. Make ingestion idempotent so duplicate invocations or reruns do not duplicate data.

Historical-run semantics

Workflow engines may associate scheduled runs with data intervals and support catchup or backfills. Review these settings before enabling a schedule with a start date in the past.

Cloud services for Cron Expressions

EventBridge Scheduler can initiate ingestion or invoke an AWS API target on a recurring calendar schedule. AWS Glue can perform the ingestion and transformation work, while Glue crawlers discover metadata for the Data Catalog. Amazon MWAA is useful when the pipeline needs explicit dependencies, readiness checks, retries, or historical processing across multiple tasks. Choose one clear owner for each recurring trigger to avoid duplicate starts. When combining these services, align time zones, pass the intended processing interval explicitly, and monitor both invocation failures and downstream job failures.

Amazon EventBridge image Amazon EventBridge

Amazon EventBridge Scheduler supports recurring cron schedules with named time zones and configurable target delivery controls. Legacy EventBridge scheduled rules also accept cron expressions but use UTC; distinguish the two scheduling mechanisms when interpreting requirements.

Open Amazon EventBridge →
AWS Glue image AWS Glue

AWS Glue supports cron-based schedules for ETL jobs through scheduled triggers and for crawlers through crawler schedules. These schedules use UTC and have five-minute minimum precision; use dependency-aware orchestration when a crawler must wait for an upstream job.

Open AWS Glue →