

# Configure pipeline execution settings for image pipelines
<a name="schedule-pipeline"></a>

You can choose from the following options to schedule pipeline execution:

Schedule Builder  
Use the Schedule Builder to configure automatic, recurring pipeline execution. You define when and how often your pipeline should run (day, time, and frequency). The default schedule is every week based on the day and time that the schedule is created (UTC).

Cron expression  
Automatically run the pipeline with a cron expression that specifies the schedule. For more information about the cron syntax that Image Builder uses, see [Use cron expressions in Image Builder](cron-expressions.md).

Manual  
The pipeline does not run on a schedule. In the console, choose **Run pipeline** from the **Actions** menu to run the pipeline. From the AWS CLI, you can run `start-image-pipeline-execution`.

**Dependency settings**  
For scheduled builds, you can choose whether to always run on the schedule or to skip pipeline execution unless there are dependency updates, such as a change to the base image or to a component that's used in the recipe. 

## Automatically disable a failing pipeline
<a name="schedule-pipeline-auto-disable"></a>

For image pipelines that run on a schedule, you can configure the maximum number of consecutive failures to allow (up to`10`) before Image Builder automatically disables the pipeline.

**Auto-disable settings**  
Image Builder tracks the number of consecutive failures for scheduled pipeline executions and takes one of the following actions each time it runs on a schedule:
+ If the pipeline execution is successful, the number of consecutive failures resets to zero.
+ If the pipeline execution fails, Image Builder increments the number of consecutive failures. If the failure count exceeds the limit defined in the `AutoDisablePolicy`, Image Builder disables the pipeline.

The consecutive failure count is also reset to zero under the following conditions:
+ The pipeline runs manually and succeeds.
+ The pipeline configuration is updated.

If the pipeline runs manually and fails, the count remains the same. The next scheduled run continues to increment where it left off before.

## Configure pipeline logging
<a name="configure-pipeline-logging"></a>

When you create or update an image pipeline, you can configure custom CloudWatch Logs groups for image build and pipeline logs. Make sure that your custom pipeline execution role has the following permissions to create and access the log group resources.
+ logs:CreateLogGroup
+ logs:CreateLogStream
+ logs:PutLogEvents

**Custom log groups**  
To use custom log groups for image build or pipeline execution, first create the log group in CloudWatch Logs. For more information, see [Create a log group](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/Working-with-log-groups-and-streams.html#Create-Log-Group) in the *Amazon CloudWatch Logs User Guide*. For additional guidance on log group naming requirements, see [CreateLogGroup](https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_CreateLogGroup.html) in the *Amazon CloudWatch Logs API Reference*.

------
#### [ Console ]

Specify the **Image log group** or **Pipeline log group** for your pipeline in the **Logging configuration** section under **Advanced settings**.

------
#### [ CLI ]

Specify the following fields within the `logging-configuration` object if you use a JSON object for configuration:
+ `imageLogGroupName`
+ `pipelineLogGroupName`

To specify all parameters directly in the command line, see [create-image-pipeline](https://docs.aws.amazon.com/cli/latest/reference/imagebuilder/create-image-pipeline.html) in the *AWS CLI Command Reference*.

------

Image Builder uses the following default log groups if you don't specify a custom log group:

Image build logs  
Image Builder writes build logs to the following Image Builder CloudWatch Logs group and stream:  
**LogGroup:** `/aws/imagebuilder/ImageName`  
**LogStream (x.x.x/x):** `ImageVersion/ImageBuildVersion`

Pipeline execution logs  
Image Builder writes pipeline execution logs to the following Image Builder CloudWatch Logs group and stream:  
**LogGroup:** `/aws/imagebuilder/pipeline/pipeline-name`  
**LogStream:** `2025/09/01` (the pipeline execution date in YYYY/MM/DD format)  
Each pipeline log is appended to the stream for that day.

# Run an image pipeline manually
<a name="pipelines-run"></a>

If you chose the manual schedule option for your pipeline, it will only run when you manually kick off the build. If you chose one of the automatic scheduling options, you can also run it manually, in between regularly scheduled runs. For example, if you have a pipeline that normally runs once a month, but you need to incorporate an update to one of your components two weeks after the prior run, you can choose to run your pipeline manually.

------
#### [ Console ]

To run your pipeline from the pipeline details page in the Image Builder console, choose **Run pipeline** from the **Actions** menu at the top of the page. A status message appears at the top of the page to notify you that your pipeline has started, or if there is an error.

1. In the upper left corner of the pipeline details page, choose **Run pipeline**, from the **Actions** menu.

1. You can see the current status of your pipeline on the **Output images** tab, in the **Status** column.

------
#### [ AWS CLI ]

The following example shows how to use the **[start-image-pipeline-execution](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/imagebuilder/start-image-pipeline-execution.html)** command in the AWS CLI to start an image pipeline manually. When you run this command, the pipeline builds and distributes a new image.

```
aws imagebuilder start-image-pipeline-execution --image-pipeline-arn arn:aws:imagebuilder:us-west-2:111122223333:image-pipeline/my-example-pipeline
```

To see what resources are created when the build pipeline runs, see [Resources created](how-image-builder-works.md#image-builder-resources).

------

# Use cron expressions in Image Builder
<a name="cron-expressions"></a>

Use cron expressions for EC2 Image Builder to set up a time window to refresh your image with updates that apply to your pipeline's base image and components. The time window for your pipeline refresh starts with the time you set in the cron expression. You can set the time in your cron expression down to the minute. Your pipeline build can run on or after the start time.

It can sometimes take a few seconds, or up to a minute for your build to start running.

**Note**  
Cron expressions use the Universal Coordinated Time (UTC) time zone by default, or you can specify the time zone. For more information about UTC time, and to find the offset for your time zone, see [Time Zone Abbreviations – Worldwide List](https://www.timeanddate.com/time/zones/).

## Supported values for cron expressions in Image Builder
<a name="ib-cron-support"></a>

EC2 Image Builder uses a cron format that consists of six required fields. Each one is separated from the others by a space in between, with no leading or trailing spaces:

`<Minute> <Hour> <Day> <Month> <Day of the week> <Year>`

The following table shows supported values for required cron entries.


**Supported values for cron expressions**  

| Field | Values | Wildcards | 
| --- | --- | --- | 
| Minute | 0-59 | , - \$1 / | 
| Hour | 0-23 | , - \$1 / | 
| Day | 1-31 | , - \$1 ? / L W | 
| Month | 1-12 or jan-dec | , - \$1 / | 
| Day of the week | 1-7 or sun-sat | , - \$1 ? L \$1 | 
| Year | 1970-2199 | , - \$1 / | 

**Wildcards**  
The following table describes how Image Builder uses wildcards for cron expressions. Keep in mind that it can take up to a minute after the time you specify for the build to start.


**Supported wildcards for cron expressions**  

| Wildcard | Description | 
| --- | --- | 
| , | The , (comma) wildcard includes additional values. In the Month field, jan,feb,mar includes January, February, and March. | 
| - | The - (dash) wildcard specifies ranges. In the day of the month field, 1-15 includes days 1 through 15 of the specified month. | 
| \$1 | The \$1 (asterisk) wildcard includes all valid values for the field.  | 
| ? | The ? (question mark) wildcard specifies that the field value depends on another setting. In the case of the Day and Day-of-week fields, when one is specified or includes all possible values (\$1), the other must be a ?. You cannot specify both. For example, if you enter a 7 in the Day field (run the build on the seventh day of the month), the Day-of-week position must contain a ?.  | 
| / | The / (forward slash) wildcard specifies increments. For example, if you want your build to run every other day, enter \$1/2 in the day field. | 
| L | The L wildcard in either of the day fields, specifies the last day: 28-31 for the day of the month, depending on what the month is, or Sunday, for the day of the week. | 
| W | The W wildcard in the Day-of-month field specifies a weekday. In the Day-of-month field, if you enter a number prior to the W, that means you want to target the weekday that is closest to that day. For instance, if you specify 3W, you want your build to run on the weekday closest to the third day of the month. | 
| \$1 | The \$1 (hash) is allowed only for the day of the week field, and must be followed by a number between 1 and 5. The number specifies which weeks in a given month apply for the build to run. For example, if you want your build to run on the second Friday of each month, use fri\$12 for the day of the week field. | 

**Restrictions**
+ You can't specify the Day-of-month and Day-of-week fields in the same cron expression. If you specify a value or `*` in one of these fields, you must use a `?` in the other.
+ Cron expressions that lead to rates faster than one minute are not supported.

## Examples of cron expressions in Image Builder
<a name="ib-cron-examples"></a>

Cron expressions are entered differently for the Image Builder console, than they are for the API or CLI. To see examples, choose the tab that applies to you.

------
#### [ Image Builder console ]

The following examples show cron expressions that you can enter into the console for your build schedule. UTC time is specified using a 24-hour clock.

**Run daily at 10:00 AM (UTC)**  
`0 10 * * ? *`

**Run daily at 12:15 PM (UTC)**  
`15 12 * * ? *`

**Run daily at midnight (UTC)**  
`0 0 * * ? *`

**Run at 10:00 AM (UTC) every weekday morning**  
`0 10 ? * 2-6 *`

**Run at 6 PM (UTC) every weekday evening**  
`0 18 ? * mon-fri *`

**Run at 8:00 AM (UTC) on the first day of every month**  
`0 8 1 * ? *`

**Run on the second Tuesday of every month at 10:30 PM (UTC)**  
`30 22 ? * tue#2 *`

**Tip**  
If you don't want your pipeline job to extend into the next day while it's running, make sure that you factor in time for your build when you specify the start time.

------
#### [ API/CLI ]

The following examples show cron expressions that you can enter for your build schedule using CLI commands or API requests. Only the cron expression is shown.

**Run daily at 10:00 AM (UTC)**  
`cron(0 10 * * ? *)`

**Run daily at 12:15 PM (UTC)**  
`cron(15 12 * * ? *)`

**Run daily at midnight (UTC)**  
`cron(0 0 * * ? *)`

**Run at 10:00 AM (UTC) every weekday morning**  
`cron(0 10 ? * 2-6 *)`

**Run at 6:00 PM (UTC) every weekday evening**  
`cron(0 18 ? * mon-fri *)`

**Run at 8:00 AM (UTC) on the first day of every month**  
`cron(0 8 1 * ? *)`

**Run on the second Tuesday of every month at 10:30 PM (UTC)**  
`cron(30 22 ? * tue#2 *)`

**Tip**  
If you don't want your pipeline job to extend into the next day while it's running, make sure that you factor in time for your build when you specify the start time.

------

## Rate expressions in Image Builder
<a name="ib-rate-expressions"></a>

A rate expression starts when you create the scheduled event rule, and then runs on its defined schedule.

Rate expressions have two required fields. Fields are separated by white space.

**Syntax**

```
rate(value unit)
```

*value*  
A positive number.

*unit*  
The unit of time. Different units are required for values of 1, such as `minute`, and values over 1, such as `minutes`.  
Valid values: minute \$1 minutes \$1 hour \$1 hours \$1 day \$1 days

**Restrictions**  
If the value is equal to `1`, then the unit must be singular. Similarly, for values greater than `1`, the unit must be plural. For example, `rate(1 hours)` and `rate(5 hour)` are not valid, but `rate(1 hour)` and `rate(5 hours)` are valid.