What does the AWS Cron Expression Generator & Builder do?
The AWS Cron Expression Generator & Builder constructs, validates, and translates 6-field AWS cron syntax (cron(Minutes Hours Day-of-month Month Day-of-week Year)) into plain human-readable explanations. It automatically handles AWS-specific scheduling rules, enforces the mandatory ? wildcard requirement, and predicts the next 5 upcoming UTC execution timestamps for Amazon EventBridge and CloudWatch Events.
Core Concepts
Understanding how AWS 6-field cron expressions differ from standard 5-field Unix cron:
- 6-Field AWS Architecture: Requires six explicit parameters:
Minutes(0-59),Hours(0-23 UTC),Day-of-month(1-31),Month(1-12 or JAN-DEC),Day-of-week(1-7 or SUN-SAT), andYear(1970-2199). - Mandatory
?Wildcard Rule: In AWS cron, you cannot specify bothDay-of-monthandDay-of-week. One must specify a value or*, while the other MUST be explicitly set to?(no specific value). - UTC Timezone Benchmark: All AWS CloudWatch and EventBridge cron rules execute strictly according to Coordinated Universal Time (UTC).
How to use the tool?
- Select a Preset or Configure Parameters:
- Pick a common preset (Every 5 minutes, Daily at Midnight, Weekday mornings) or customize the 6 parameter fields.
- Generate & Validate: Click Convert Input Fields to AWS Cron Expression to assemble the expression and inspect predicted execution times.
- Copy & Deploy: Click Copy next to the generated
cron(...)string and paste it into your CloudFormation template, Terraform manifest, or AWS Console.
Related Developer Utilities
If you work with AWS cloud infrastructure, automation, and regular expressions, explore these complementary tools:
- cURL to AWS SigV4 Converter: Convert HTTP requests into AWS Signature Version 4 headers.
- AWS IAM Policy Minifier: Compress IAM policies and resolve 6,144 character quota errors.
- Cron to Systemd Timer Converter: Convert cron expressions into Linux systemd service timers.
- Regex Tester & Pattern Library: Test regular expressions in real time.
REST API Integration
Blueutils provides a free REST API endpoint (POST https://blueutils.com/api/aws/aws-cron-generator) to programmatically build, validate, and generate 6-field AWS cron expressions (cron(Minutes Hours Day-of-month Month Day-of-week Year)).
API Request Parameters
| Name | Type | Description | Example |
|---|---|---|---|
input |
Object / String | Schedule parameters object or raw cron(...) string. |
{"minutes":"0/20","hours":"*"} |
options |
Object | Optional generation settings. | {} |
API Request Payload Examples
cURL (Structured Object)
curl -X POST https://blueutils.com/api/aws/aws-cron-generator \
-H "Content-Type: application/json" \
-d '{
"input": {
"minutes": "0/20",
"hours": "*",
"dayOfMonth": "?",
"month": "*",
"dayOfWeek": "*",
"year": "*"
}
}'Python
import requests
url = "https://blueutils.com/api/aws/aws-cron-generator"
payload = {
"input": {
"minutes": "0",
"hours": "12",
"dayOfMonth": "?",
"month": "*",
"dayOfWeek": "MON-FRI",
"year": "*"
}
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.json())Java
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Main {
public static void main(String[] args) throws Exception {
String jsonPayload = """
{
"input": {
"minutes": "0",
"hours": "12",
"dayOfMonth": "?",
"month": "*",
"dayOfWeek": "MON-FRI",
"year": "*"
}
}
""";
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://blueutils.com/api/aws/aws-cron-generator"))
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(jsonPayload))
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
}API Response Parameters
| Name | Type | Description | Example |
|---|---|---|---|
isValid |
Boolean | Indicates whether AWS cron generation succeeded. | true |
cronExpression |
String | Formatted 6-field AWS cron expression string. | "cron(0/20 * ? * * *)" |
humanReadable |
String | Plain English explanation of the schedule in UTC. | "every 20 minutes" |
nextExecutions |
Array | Next 5 predicted UTC execution timestamps. | ["Thu, 13 Aug 2026 11:00:00 GMT", ...] |
API Response Payload Examples
Success Response (HTTP 200 OK)
{
"isValid": true,
"cronExpression": "cron(0/20 * ? * * *)",
"humanReadable": "every 20 minutes",
"nextExecutions": [
"Thu, 13 Aug 2026 11:00:00 GMT",
"Thu, 13 Aug 2026 11:20:00 GMT",
"Thu, 13 Aug 2026 11:40:00 GMT",
"Thu, 13 Aug 2026 12:00:00 GMT",
"Thu, 13 Aug 2026 12:20:00 GMT"
]
}Validation Failure Response (HTTP 400 Bad Request)
{
"isValid": false,
"error": "AWS Cron Syntax Error: Day-of-month and Day-of-week cannot both be specified. Exactly one of them must be \"?\" in AWS 6-field cron expressions."
}Rate Limit Exceeded Response (HTTP 429 Too Many Requests)
{
"error": "API rate limit exceeded. Please wait or contact support@blueutils.com."
}Why use an API to generate AWS cron expressions?
Integrating the AWS Cron Generator API into infrastructure provisioning pipelines, Terraform modules, or serverless deployment tooling provides essential benefits:
- Rapid Script Validation: Automatically enforces AWS 6-field syntax and
?wildcard validation before deploying EventBridge rules to AWS CloudFormation. - Optimized Token Efficiency for AI Agents: LLMs frequently mix up 5-field Unix cron syntax with 6-field AWS syntax. Invoking the API returns the exact AWS string and upcoming execution timestamps deterministically.
- Deterministic Accuracy Without Hallucinations: Ensures 100% compliant schedule compilation and prediction across complex step ranges, day-of-week literals, and UTC offsets.
Native Usage
How to validate or test AWS cron schedules locally in terminal environments or scripts:
Windows (CMD / PowerShell)
# Validate 6-field cron syntax using Node.js in PowerShell
node -e "
const expr = 'cron(0 12 ? * MON-FRI *)';
const parts = expr.replace(/^cron\(|\)$/g, '').split(' ');
console.log('Valid AWS 6-field format:', parts.length === 6 && (parts[2] === '?' || parts[4] === '?'));
"Linux / Unix (Bash)
# Verify AWS cron expression format using awk
echo "0 12 ? * MON-FRI *" | awk '{ if (NF == 6 && ($3 == "?" || $5 == "?")) print "Valid AWS Cron"; else print "Invalid"; }'Python
Using Python to format standard AWS cron strings:
def format_aws_cron(minute="0", hour="12", dom="?", month="*", dow="MON-FRI", year="*"):
if dom != "?" and dow != "?":
raise ValueError("One of dom or dow must be '?'")
return f"cron({minute} {hour} {dom} {month} {dow} {year})"
print(format_aws_cron(minute="0/15", hour="*", dom="?"))Java
Using Java to format AWS cron strings:
public class AwsCronExample {
public static String buildAwsCron(String min, String hr, String dom, String mon, String dow, String yr) {
if (!dom.equals("?") && !dow.equals("?")) {
throw new IllegalArgumentException("Either Day-of-month or Day-of-week must be '?'");
}
return String.format("cron(%s %s %s %s %s %s)", min, hr, dom, mon, dow, yr);
}
public static void main(String[] args) {
System.out.println(buildAwsCron("0", "12", "?", "*", "MON-FRI", "*"));
}
}